Home > Software engineering >  MFC dialog map as a background, the slider control background to black, ask for help! Thank you very
MFC dialog map as a background, the slider control background to black, ask for help! Thank you very

Time:09-30

Load the OnPaint () picture as the background of the dialog box, found the slider control background black (as shown in figure 1), and after sliding into the appearance of figure 2,
Controls the slider control background mode to Transparent and the Transparent, did not solve,

Beg god for help, thank you very much!


(figure 1)


(figure 2)

CodePudding user response:

Control transparency,,,

CodePudding user response:

reference 1st floor shen_wei response:
control transparency,,,


Thanks, just have the right controls to turn Transparent, always have no effect

CodePudding user response:

All controls for no reason? Or is it just the slider?

CodePudding user response:

Stick the code come out, have time to help you to look at

CodePudding user response:

The
reference 3 floor jimoguilai response:
all controls like this? Or is it just the slider?


Other controls are no problems, only the slider to the first question,

I wrote to load in the OnPaint background image:
CPaintDC dc (this);
CRect rc;
GetClientRect (& amp; Rc);
Dc. SetStretchBltMode (COLORONCOLOR);
The CDC dcMem.
DcMem. CreateCompatibleDC (& amp; Dc);
CBitmap bmpBG;
BmpBG. LoadBitmap (IDB_BG1);//IDB_BG1 background is the ID of the

BITMAP bitmap1;
BmpBG. GetBitmap (& amp; Bitmap1);
CBitmap * pbmpPri=dcMem. SelectObject (& amp; BmpBG);
Dc. StretchBlt (0, 0, rc Width (), rc, Height (), & amp; DcMem, 0, 0, bitmap1 bmWidth, bitmap1. BmHeight, SRCCOPY);

In OnCtlColor () by the following code to achieve the static, editing, and so on control the background transparent:
HBRUSH gets=CDialog: : OnCtlColor (pDC, pWnd, nCtlColor);
If (nCtlColor==CTLCOLOR_STATIC | | nCtlColor==CTLCOLOR_SCROLLBAR)
{
PDC - & gt; SetBkMode (TRANSPARENT);//transparent
Return (HBRUSH) : : GetStockObject (NULL_BRUSH);
}
Opaque background on the slider can be actually, but it is now a black background, and after about sliding the slider, there will be a problem as shown in figure 2, I had a lot to change the properties of the controls are False and True a lot of change, make bad also, below is the attribute of the slider now screenshots


Thank you.

CodePudding user response:

Hello your problem solved? I also encountered the same problem now

CodePudding user response:

I was such a problem, only to me is the Static text is black background, what a great god can tell me what's going on?

CodePudding user response:

This is why the reason for the existence of the DUI
  • Related