在线急等!初始化的时候如何设置Dialog的背景色?

mainboy 2006-08-30 10:00:38
具体代码怎么写?设为灰色就可以了,新手,希望高手帮忙!
...全文
249 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
mainboy 2006-08-30
  • 打赏
  • 举报
回复
谢谢各位大虾
折腾_苏州 2006-08-30
  • 打赏
  • 举报
回复
yun,野不说清楚。。。。。。。
单独的可以如cleverwyq(此人三无) 所做
mainboy 2006-08-30
  • 打赏
  • 举报
回复
CDlgChat这个是一个新建的窗口,我只要改这里面的背景。其他的窗口背景不要改
mainboy 2006-08-30
  • 打赏
  • 举报
回复
BOOL CxxxxxApp::InitInstance()
这个是改全局的,我只要改这个单独的Dialog啊。
折腾_苏州 2006-08-30
  • 打赏
  • 举报
回复
我好象讲的够清楚了吧,再你的CxxxAPP类的InitInstance()设置

BOOL CxxxxxApp::InitInstance()
{
SetDialogBkColor(RGB(192,192,192),RGB(0,0,0));
....
}
mainboy 2006-08-30
  • 打赏
  • 举报
回复
是另外设置吗?我的初始化窗口函数是这个,不是在这里面设置吗?
BOOL CDlgChat::OnInitDialog()
{
SetDialogBkColor(RGB(192,192,192),RGB(0,0,0));
//……………………
return TRUE;
}
cleverwyq 2006-08-30
  • 打赏
  • 举报
回复
HBRUSH CCommDlgDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

// TODO: Change any attributes of the DC here
//if(pWnd->GetDlgCtrlID() ==IDD_COMMDLG_DIALOG)
{
brush.Detach();
brush.CreateSolidBrush(RGB(192,192,192));
hbr= brush;
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
折腾_苏州 2006-08-30
  • 打赏
  • 举报
回复
BOOL CxxxxxApp::InitInstance()
{
SetDialogBkColor(RGB(192,192,192),RGB(0,0,0));
....
}
handsomerun 2006-08-30
  • 打赏
  • 举报
回复
我不记得灰色的值了,晕
handsomerun 2006-08-30
  • 打赏
  • 举报
回复
CWinApp::SetDialogBkColor
void SetDialogBkColor( COLORREF clrCtlBk = RGB(192, 192, 192), COLORREF clrCtlText = RGB(0, 0, 0) );

Parameters

clrCtlBk

The dialog background color for the application.

clrCtlText

The dialog control color for the application.

Remarks

Call this member function from within the InitInstance member function to set the default background and text color for dialog boxes and message boxes within your application.

Example

BOOL CMyApp::InitInstance()
{
// Standard initialization

SetDialogBkColor(); // Set dialog background color to gray
LoadStdProfileSettings(); // Load standard INI file options (including MRU)

// ...
}

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧