相关主题

1.
用纯色
设置对话对话框的背景色

2.
用位图
设置对话对话框的背景色

3.
使用Picture
Ctrl来设置背景图片

 
 
 
 

对话框背景色

 
 
其他相关
 
 
 
 
 

代码::用纯色
设置对话对话框的背景色

HBRUSH
CProject01Dlg::OnCtlColor(CDC* pDC,
CWnd* pWnd, UINT nCtlColor)
{
    HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
    // TODO: Change any
attributes of the DC here
    CBrush cbrush(RGB(255,0,0));
    CRect crect;
    GetClientRect(crect);
    pDC->SelectObject(&cbrush);
    pDC->FillRect(crect,&cbrush);
    return cbrush;
    // TODO: Return a different
brush if the default is not desired
    return hbr;

}

 

效果图

有个现象当单击1个按钮时
部分按钮会被隐藏

 
 

代码::用位图
设置对话对话框的背景色

  resources 导入1个bitmap位图
 
// mfcDlg.h : header file
// Implementation
protected:
    HICON m_hIcon;

CBrush m_BKBrush;//画刷

            
::OnInitDialog()
    // TODO: Add extra initialization here
    CBitmap* pBitmap = new CBitmap;
    ASSERT(pBitmap);
    pBitmap->LoadBitmap(IDB_BITMAP1);//载入位图资源
    m_BKBrush.CreatePatternBrush(pBitmap);//创建位图画刷
    delete pBitmap;
                                      
::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
    // TODO: Change any attributes of the DC here
    if (nCtlColor == CTLCOLOR_DLG ) 
        return (HBRUSH)m_BKBrush.GetSafeHandle(); //返回创建的位图画刷    
    // TODO: Return a different brush if the default is not desired
 

效果图

 
关联picDialog
Shape

C++ BackColor_Dialog的更多相关文章

随机推荐

  1. UML类图设计

    大纲: 在Visio里,包和类的关系是包含关系,将类拖入包的文件夹之后,关系就建立了,二元关联符号可以设置为:聚合.合成.接口:空心圆+直线(唐老鸭类实现了‘讲人话’):依赖:虚线+箭头(动物和空气的 ...

  2. [Papers]NSE, $u_3$, Lebesgue space [Zhou-Pokorny, Nonlinearity, 2009]

    $$\bex u_3\in L^p(0,T;L^q(\bbR^3)),\quad \frac{2}{p}+\frac{3}{q}=\frac{3}{4}+\frac{1}{2q},\quad \fra ...

  3. http://jingyan.baidu.com/article/4dc40848e7b69bc8d946f127.html

    http://jingyan.baidu.com/article/4dc40848e7b69bc8d946f127.html

  4. 【LeetCode 207】Course Schedule

    There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prer ...

  5. 在Lua里写unity游戏笔记

    gameobject.GetComponent<Transform>(); 翻译成Lua: gameObject:GetComponent (luanet.ctype (Transform ...

  6. 【原】Kryo序列化篇

    Kryo是一个快速有效的对象图序列化Java库.它的目标是快速.高效.易使用.该项目适用于对象持久化到文件或数据库中或通过网络传输.Kryo还可以自动实现深浅的拷贝/克隆. 就是直接复制一个对象对象到 ...

  7. Python之正则

    从学习Python至今,发现很多时候是将Python作为一种工具.特别在文本处理方面,使用起来更是游刃有余. 说到文本处理,那么正则表达式必然是一个绝好的工具,它能将一些繁杂的字符搜索或者替换以非常简 ...

  8. [Hive - LanguageManual] Create/Drop/Alter -View、 Index 、 Function

    Create/Drop/Alter View Create View Drop View Alter View Properties Alter View As Select Version info ...

  9. HDU-4738 Caocao's Bridges 边联通分量

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4738 题意:在有重边的无向图中,求权值最小的桥. 注意trick就好了,ans为0时输出1,总要有一个 ...

  10. Spark的应用程序

    Spark的应用程序,分为两部分:Spark driver 和 Spark executor.