Home > Software engineering >  Problems setting up the control color
Problems setting up the control color

Time:09-26


HBRUSH CTreetotalDlg: : OnCtlColor (CDC * pDC, CWnd * pWnd, UINT nCtlColor)
{
HBRUSH gets=CDialogEx: : OnCtlColor (pDC, pWnd, nCtlColor);

CFont * CFont=new CFont;
CFont - & gt; CreateFont (16,0,0,0 FW_SEMIBOLD, FALSE, FALSE, 0,
ANSI_CHARSET OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS DEFAULT_QUALITY,
DEFAULT_PITCH & amp; FF_SWISS, _T (" Arial "));

The switch (WM_CTLCOLOR)//fill what;
{
Case CTLCOLOR_STATIC:
{pDC - & gt; SetBkMode (TRANSPARENT);//set the background to transparent.
PDC - & gt; SetTextColor (RGB (255255, 0));
PWnd - & gt; The SetFont (cFont);//set the font;
HBRUSH B=CreateSolidBrush (RGB (125125255));
Return (HBRUSH) B;//returns a handle to a brush.
}
Case CTLCOLOR_EDIT:

CodePudding user response:

Should be the switch (nCtlColor)
Refer to http://blog.csdn.net/createdsign/article/details/18984145

CodePudding user response:

Good
I see

CodePudding user response:

The switch (WM_CTLCOLOR)//fill what;

the switch (nCtlColor)

CodePudding user response:

Tried, the effect is very poor, always flash, there are a great god can solve it, is the problem that the code or color parameters of the problem

CodePudding user response:

1 the font in the initialization time to create a
2 all SelectObject to restore to the original value
3 all the Create DeleteObject
  • Related