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




  • 相关阅读:
    -_-#【Angular】工具函数
    -_-#【m3u】
    -_-#【Angular】依赖注入
    -_-#【响应式图片】
    CODEVS——T1519 过路费
    CODEVS——T1979 第K个数
    Vijos——T1279 Leave-绿光
    HDU——T 2824 The Euler function
    洛谷——P1096 Hanoi双塔问题
    python(36)- 测试题
  • 原文地址:https://www.cnblogs.com/xe2011/p/3885696.html
Copyright © 2011-2022 走看看