如何改变程序主界面的背景颜色!

jxfzamdzyx 2004-05-06 10:01:19
我想问一下!如何改变程序主界面的背景颜色!
...全文
413 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
jxfzamdzyx 2004-05-08
  • 打赏
  • 举报
回复
问题已解决!
jxfzamdzyx 2004-05-08
  • 打赏
  • 举报
回复
逍遥浪子!不行呀!显示

error C2039: 'SetDialogBkColor' : is not a member of 'CFMXL1Dlg'
caterpillarlover 2004-05-08
  • 打赏
  • 举报
回复
SetBkColor
youki1234 2004-05-08
  • 打赏
  • 举报
回复
搭个车问一下:
怎么改变单文档view窗口的颜色呢?还有怎么改变单文档的工具条的颜色呢?
freew 2004-05-08
  • 打赏
  • 举报
回复
BOOL CPIMApp::InitInstance()
{
AfxEnableControlContainer();

// Standard initialization

this->SetDialogBkColor(RGB(220,233,248));//设置对话框背景颜色

CPIMDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}

// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
wangjs720 2004-05-08
  • 打赏
  • 举报
回复
SetDialogBkColor(RGB(190,190,100),RGB(0,0,0));
在VC7中取消了这个函数
jxfzamdzyx 2004-05-08
  • 打赏
  • 举报
回复
请大家帮帮忙,我如何才可改变我对话框的悲景颜色!z在初始化里加SetDialogBkColor(RGB(190,190,100),RGB(0,0,0));这句好象不行!
jxfzamdzyx 2004-05-07
  • 打赏
  • 举报
回复
mingbao!好象不行,显示error C2065: 'SetDialogBkColor' : undeclared identifier
kuangjingbo 2004-05-06
  • 打赏
  • 举报
回复
SetClassLong
mingbao 2004-05-06
  • 打赏
  • 举报
回复
拿基于对话框的应用程序来说,比如有一个Test的项目,在项目的应用程序类中加入下面一句话:
BOOL CTestApp::InitInstance()
{
AfxEnableControlContainer();

// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.

#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

CTestDlg dlg;
m_pMainWnd = &dlg;
SetDialogBkColor(RGB(190,190,100),RGB(0,0,0));//注意,就是这句话
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}

// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
solarhe 2004-05-06
  • 打赏
  • 举报
回复
在OnDraw()写入如下代码就可以改变
//...
CRect r;
GetClientRect(&r);
Brush brush;
brush.CreateBrush(......//此处定义颜色,我在网吧,记不大清楚,你可以这样试试!
pDC->rectangle(&r);
suisuibianbian 2004-05-06
  • 打赏
  • 举报
回复
SetBkColor
wangjs720 2004-05-06
  • 打赏
  • 举报
回复
处理WM_ERASEBKGND就行了,在它的响应函数里重画
_foo 2004-05-06
  • 打赏
  • 举报
回复
如果是sdi的话主要是改view窗口的背景色

有很多种方法的

可以在wm_paint中画,可以在WM_ERASEBKGND中画,可以改变窗口类的背景画刷等

faq中有

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

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