本文主要是介绍MFC BCG使用:修改Edit (CBCGPEdit) 背景色和文本颜色,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
先看效果图
这里edit编辑框背景
直接上代码
pEditValue = new CEdit;pEditValue->Create(dwStyle, CControlRect, pParentWnd, nID + 1);pEditValue->SetFont(mFont2);pEditValue->SetWindowText(nStrPara);pEditValue->EnableWindow(TRUE);CBCGPEditColors colors;colors.m_clrBackground = RGB(23, 195, 212);// RGB(219, 229, 244);colors.m_clrBorder = RGB(193, 210, 236);colors.m_clrBorderFocused = RGB(0, 191, 255);colors.m_clrText = CLR_WHITE;//RGB(0, 128, 255);colors.m_clrPrompt = RGB(112, 147, 219);pEditValue->SetColorTheme(colors);
需要注意的是:
使用BCG的EDIT继承方法
#include "BCGCBProInc.h"
#define CGroupBox CBCGPGroup
#define CTabbedControlBar CBCGPTabbedControlBar
#define CNEWButton CBCGPButton
#define CEdit CBCGPEdit
#define CComboBox CBCGPComboBox
#define CStatusBar CBCGPStatusBar
#define CDialog CBCGPDialog
#define CDialogEx CBCGPDialog
#define CWinApp CBCGPWinApp
#define CListCtrl CBCGPListCtrl
这篇关于MFC BCG使用:修改Edit (CBCGPEdit) 背景色和文本颜色的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!