zoukankan      html  css  js  c++  java
  • 文本框控件字体,背景色都可以单独设置。

    字体,背景色都可以单独设置。

    HBRUSH CUDPDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
    {
        HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
        
        // TODO: Change any attributes of the DC here
        if (pWnd->GetDlgCtrlID()==IDC_STATIC_TITLE)
        {
            //设置绘图dc的背景模式为透明模式.
            pDC->SetBkMode(TRANSPARENT);//设置透明窗口.
            
            pDC->SetTextColor(RGB(255,255, 0));//设置文本颜色
            //pWnd->SetFont(cFont);//设置字体
            
            HBRUSH B = CreateSolidBrush(RGB(125,125,255));
            return (HBRUSH) B;//作为约定,返回背景色对应的刷子句柄
            
            //return (HBRUSH)::GetStockObject(RGB(125,125,255)); // 设置背景色
            
            GetDlgItem(IDC_STATIC_TITLE)->GetParent()->RedrawWindow();//不重叠
        }
        if (pWnd->GetDlgCtrlID()==IDC_RECV_LEN1)
        {
            //设置绘图dc的背景模式为透明模式.
        
            pDC->SetTextColor(RGB(255,0, 0));//设置文本颜色
            //pWnd->SetFont(cFont);//设置字体
            HBRUSH B = CreateSolidBrush(RGB(255,255,255));
            return (HBRUSH) B;//作为约定,返回背景色对应的刷子句柄
            GetDlgItem(IDC_RECV_LEN1)->GetParent()->RedrawWindow();//不重叠
        }
        // TODO: Return a different brush if the default is not desired
        return hbr;
    }
    发现自己的不足,善于利用找到的方法去扬长避短。行动起来。
  • 相关阅读:
    powershell:clear-item
    windows-杂笔
    powershell:Clear-EventLog
    powershell:Get-ChildItem
    powershell 杂笔
    power-shell:clear-content
    powershell:checkpoint-computer
    vim-缩进设置
    powershell:move-item
    powershell:add-content
  • 原文地址:https://www.cnblogs.com/rechen/p/5100228.html
Copyright © 2011-2022 走看看