基于对话框的程序
CRect rect;
CPaintDC dc(this);
GetClientRect(rect);
rect.top-=100;
dc.FillSolidRect(rect,RGB(0,255,0)); //设置为绿色背景
CDialog::OnPaint();
结果菜单和工具条那2行都没有背景色,其他地方都有
怎么解决?
CRect rect;
CPaintDC dc(this);
GetClientRect(rect);
rect.top-=100;
dc.FillSolidRect(rect,RGB(0,255,0)); //设置为绿色背景
CDialog::OnPaint();
结果菜单和工具条那2行都没有背景色,其他地方都有
怎么解决?
SetDialogBkColor(RGB(100,100,200),RGB(0,0,0));
这个消息是做什么用的?
重载WM_ERASEBKGND只需在ClassWinzad(VC6)或窗体类属性页中选消息WM_ERASEBKGND的实现函数(VC.net)就ok了
还是那种情况
HBRUSH CTestDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
//更改背景颜色
if (nCtlColor != CTLCOLOR_EDIT && nCtlColor != CTLCOLOR_LISTBOX)
{
pDC->SetBkMode(TRANSPARENT);
HBRUSH B = CreateSolidBrush(RGB(255,0,0));//更改颜色值
return (HBRUSH) B;
} HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here // TODO: Return a different brush if the default is not desired
return hbr;
}
我得blog http://blog.csdn.net/orbit/
void CMy11Dlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CRect rect;
CPaintDC dc( this);
GetClientRect( rect);
dc.FillSolidRect( rect, RGB( 0, 255, 0)); //设置为绿色背景 CDialog::OnPaint();
}
}