zoukankan      html  css  js  c++  java
  • C++ BackColor_Dialog

    相关主题

    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
        CBitmappBitmap = new CBitmap;
        ASSERT(pBitmap);
        pBitmap->LoadBitmap(IDB_BITMAP1);//载入位图资源
        m_BKBrush.CreatePatternBrush(pBitmap);//创建位图画刷
        delete pBitmap;
                                          
    ::OnCtlColor(CDCpDCCWndpWndUINT 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




  • 相关阅读:
    Idea中资源文件的设置和Java中类的权限
    Springboot中slf4j+log4j2的使用
    linux下修改文件查看样式(日期/文件大小)
    maven项目中引入外部jar
    01背包问题
    python爬取千千音乐
    【DataBase】SQL优化案例:其一
    【Uni-App】底部栏踩坑
    【Uni-App】UniApp转微信小程序发布应用
    【Uni-App】API笔记 P2
  • 原文地址:https://www.cnblogs.com/xe2011/p/3885696.html
Copyright © 2011-2022 走看看