static透明

来源:互联网 发布:macbook修图软件 知乎 编辑:程序博客网 时间:2024/04/27 15:26

1).h文件中加入:afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);

2).c文件中加入ON_WM_CTLCOLOR()宏

定义函数HBRUSH CPCServerDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)     {    HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);  

 switch(nCtlColor)    {    case   CTLCOLOR_STATIC:     pDC->SetBkColor(RGB(255, 255, 0));  hbr = CreateSolidBrush(RGB(255, 255, 0));  break; }  

 return hbr;   }

3)其他控件如下:

CTLCOLOR_BTN        Button   control     CTLCOLOR_DLG        Dialog   box     CTLCOLOR_EDIT       Edit   control     CTLCOLOR_LISTBOX    List-box   control     CTLCOLOR_MSGBOX     Message   box     CTLCOLOR_SCROLLBAR  Scroll-bar   control     CTLCOLOR_STATIC     Static   control

记住:单选,多选按钮的文字以及readonly,disable的文本框都算CTLCOLOR_STATIC

原创粉丝点击