Changing Background color and Static Control background color.
-
Hi all, i m using this.
1. declare it in header file.
protected:
CBrush m_brush;- now on OnInitDialg()
m_brush.CreateSolidBrush(RGB(245, 245, 245)); // color white brush
3.now on OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
return m_brush;but here edit contol also colored with this color. please tell me how can i change Back ground color of dialog box and back ground color of static control.
To accomplish great things, we must not only act, but also dream; not only plan, but also believe.
- now on OnInitDialg()
-
Hi all, i m using this.
1. declare it in header file.
protected:
CBrush m_brush;- now on OnInitDialg()
m_brush.CreateSolidBrush(RGB(245, 245, 245)); // color white brush
3.now on OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
return m_brush;but here edit contol also colored with this color. please tell me how can i change Back ground color of dialog box and back ground color of static control.
To accomplish great things, we must not only act, but also dream; not only plan, but also believe.
Hi, Create a class for the control, then return the brush in OnCtlColor()(in the new class).Just try it iam not sure about the result.
- now on OnInitDialg()
-
Hi all, i m using this.
1. declare it in header file.
protected:
CBrush m_brush;- now on OnInitDialg()
m_brush.CreateSolidBrush(RGB(245, 245, 245)); // color white brush
3.now on OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
return m_brush;but here edit contol also colored with this color. please tell me how can i change Back ground color of dialog box and back ground color of static control.
To accomplish great things, we must not only act, but also dream; not only plan, but also believe.
If you read here[^], you find WM_CTLCOLORDLG[^] and WM_CTLCOLORSTATIC[^], maybe try handling these messages instead of WM_CTLCOLOR, aside of that, the documentation also states this for WM_CTLCOLOR: lParam A handle to a child window (control). This is the handle of the control asking for the color information, you could use that to filter out the controls you wish to change the background color.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
- now on OnInitDialg()
-
If you read here[^], you find WM_CTLCOLORDLG[^] and WM_CTLCOLORSTATIC[^], maybe try handling these messages instead of WM_CTLCOLOR, aside of that, the documentation also states this for WM_CTLCOLOR: lParam A handle to a child window (control). This is the handle of the control asking for the color information, you could use that to filter out the controls you wish to change the background color.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <