change the background color of a dialog box mfc(更改对话框的背景颜色 mfc)
问题描述
我正在尝试更改对话框的背景颜色(win 7、vs2010、c++).我试图捕捉 WM_CTLCOLOR ,WM_ERASEBKGND 并改变颜色.我设法以这种方式更改背景颜色,但是当窗口完成上传时,颜色恢复为默认值,但我注意到框架的颜色正确.我认为我正在更改窗口而不是对话框或类似的东西.我用 WTL(不是 AFX)来做这个.
I'm trying to change the background color of a dialog box (win 7, vs2010,c++). I tried to catch WM_CTLCOLOR ,WM_ERASEBKGND and change the color. I manged to change in this way the backgroung color, but when the window is finish to upload itself, the color is back to default but I noticed that the frame is in the right color. I think that I'm changing the window and not the dialog box or something like that. I'm doing this with WTL (not AFX).
我该怎么办?
推荐答案
试试这个:
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
/
本文标题为:更改对话框的背景颜色 mfc
基础教程推荐
- 在 C++ 中循环遍历所有 Lua 全局变量 2021-01-01
- 管理共享内存应该分配多少内存?(助推) 2022-12-07
- 使用从字符串中提取的参数调用函数 2022-01-01
- 为 C/C++ 中的项目的 makefile 生成依赖项 2022-01-01
- Windows Media Foundation 录制音频 2021-01-01
- 如何“在 Finder 中显示"或“在资源管理器中显 2021-01-01
- 如何在不破坏 vtbl 的情况下做相当于 memset(this, ...) 的操作? 2022-01-01
- 如何使图像调整大小以在 Qt 中缩放? 2021-01-01
- 从 std::cin 读取密码 2021-01-01
- 为什么语句不能出现在命名空间范围内? 2021-01-01