相关主题

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. 【转】简单内存泄漏检测方法 解决 Detected memory leaks! 问题

    我的环境是: XP SP2 . VS2003 最近在一个项目中,程序退出后都出现内存泄漏: Detected memory leaks! Dumping objects -> {98500} n ...

  2. storm入门教程 第一章 前言[转]

    1.1   实时流计算 互联网从诞生的第一时间起,对世界的最大的改变就是让信息能够实时交互,从而大大加速了各个环节的效率.正因为大家对信息实时响应.实时交互的需求,软件行业除了个人操作系统之外,数据库 ...

  3. 多校5 1001 HDU5781 ATM Mechine 记忆化搜索+概率

    // 多校5 1001 HDU5781 ATM Mechine // http://acm.hdu.edu.cn/search.php?field=problem&key=2016+Multi ...

  4. <Araxis Merge>快速一览文件的比较与合并

    重要的文件比较与合并特性在下面都指出了.对每个特性的说明性内容在下面可以找到. 注意:只有双向的比较/合并被展示了,专业版的Merge还支持三向的比较/合并. 1.文件夹比较按钮 单击这个工具栏按钮会 ...

  5. 批量ping主机脚本

    #! /bin/bash for i in `cat test.list`do   host=`echo $i|awk -F"," '{print $1}'`   app_IP=` ...

  6. work_1

    Github的用户名为heiheitian 教科书:代码大全第2版 重构 一维最大子数组之和: #include<stdio.h>void MaxSumSonArrays(int a[], ...

  7. HDU 5776 sum (模拟)

    sum 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5776 Description Given a sequence, you're asked ...

  8. linux下面的查找命令

    在linux下面经常用查找命令,我自己最常用的是find whereis locate 关于find 我常用find的基本功能,如 find / -name filename 在某个目录下寻找文件. ...

  9. codeforces 622A Infinite Sequence

    A. Infinite Sequence time limit per test 1 second memory limit per test 256 megabytes input standard ...

  10. [iOS微博项目 - 1.6] - 自定义TabBar

    A.自定义TabBar 1.需求 控制TabBar内的item的文本颜色(普通状态.被选中状态要和图标一致).背景(普通状态.被选中状态均为透明) 重新设置TabBar内的item位置,为下一步在Ta ...