• 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




  • 相关阅读:
    apscheduler 踩坑
    fastapi 导出excel文件
    python flask 使用日志
    git 头指针游离问题
    C# 连接mysql填坑
    前端项目proxy小问题
    需完善--日志框架
    依赖<dependency>的scope了解
    git 退回到指定tag版本
    git切换远程仓库地址
  • 原文地址:https://www.cnblogs.com/xe2011/p/3885696.html
Copyright © 2020-2023  润新知