刘华世的官方博客

C++语言 颜色对话框调用

复制代码
WM_CTLCOLOR事件

HBRUSH CFontDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
    HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
    
    // TODO: Change any attributes of the DC here
    if(nCtlColor == CTLCOLOR_EDIT) //判断是否为编辑框控件
        pDC->SetBkColor(m_Color); //设置文本背景颜色
        //pDC->SetTextColor(m_Color); //设置文本前景颜色

    // TODO: Return a different brush if the default is not desired
    return hbr;
}
复制代码
posted @   pythonschool  阅读(310)  评论(0编辑  收藏  举报
努力加载评论中...
刘华世的官方博客
点击右上角即可分享
微信分享提示