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




  • 相关阅读:
    28、vSocket模型详解及select应用详解
    27、通过visual s'tudio 验证 SOCKET编程:搭建一个TCP服务器
    26、TCP服务器原理
    8、字符串操作
    9、内存操作
    ESP32作为接入点AP
    ·通过wifi_scan学习esp32wifi程序编写
    10、指针变量基础
    关于wifi网络基本原理了解
    开发团队中命名规范的重要性
  • 原文地址:https://www.cnblogs.com/xe2011/p/3885696.html
Copyright © 2011-2022 走看看