Setting Background Color
-
HI everybody! I need to know how to set the background color of a view. I have tried using the 'SetBkColor(COLORREF color)' function but I can't get it to work. I called the following line in the
Draw
function in class CView.pDC->SetBkColor(COLORREF color);
And the background color remains white. Can anybody tell me what to do? _Lostris. . . -
HI everybody! I need to know how to set the background color of a view. I have tried using the 'SetBkColor(COLORREF color)' function but I can't get it to work. I called the following line in the
Draw
function in class CView.pDC->SetBkColor(COLORREF color);
And the background color remains white. Can anybody tell me what to do? _Lostris. . .you need to "paint" it. CDC::FillRect or something similir.
Maximilien Lincourt Your Head A Splode - Strong Bad
-
HI everybody! I need to know how to set the background color of a view. I have tried using the 'SetBkColor(COLORREF color)' function but I can't get it to work. I called the following line in the
Draw
function in class CView.pDC->SetBkColor(COLORREF color);
And the background color remains white. Can anybody tell me what to do? _Lostris. . .MSDN says: "Sets the current background color to the specified color. If the background mode is OPAQUE, the system uses the background color to fill the gaps in styled lines, the gaps between hatched lines in brushes, and the background in character cells. The system also uses the background color when converting bitmaps between color and monochrome device contexts." So, if you don't write or draw anything, you won't see the desired color. My suggestion for the 'OnDraw(..)' function: CRect rect; GetClientRect(rect); pDC->FillSolidRect(rect, RGB(255,0,0)); There might be other solutions.
-
HI everybody! I need to know how to set the background color of a view. I have tried using the 'SetBkColor(COLORREF color)' function but I can't get it to work. I called the following line in the
Draw
function in class CView.pDC->SetBkColor(COLORREF color);
And the background color remains white. Can anybody tell me what to do? _Lostris. . .In a Win32 application you can set the hbrBackground member of the window class structure typically in "MyRegisterClass". wcex.hbrBackground = CreateSolidBrush(RGB(255, 0, 0)); // This makes the window red In MFC you can do something similar in PreCreateWindow. Due Regards Mahendra
-
you need to "paint" it. CDC::FillRect or something similir.
Maximilien Lincourt Your Head A Splode - Strong Bad