Win32中改变Edit控件字体颜色

WM_:
CTLCOLORBTN       Button control
CTLCOLORDLG       Dialog box
CTLCOLOREDIT      Edit control
CTLCOLORLISTBOX    List-box control
CTLCOLORMSGBOX     Message box
CTLCOLORSCROLLBAR  Scroll-bar control
CTLCOLORSTATIC     Static control

使用:

case WM_CTLCOLOREDIT://设置Edit颜色
	{
		if (GetDlgItem(hWnd, IDB_EDIT_MAIN_Buy_Address_1) == (HWND)lParam)//这里的1是静态文本框的ID
		{
			SetTextColor((HDC)wParam, RGB(0, 122, 204));
			SetBkMode((HDC)wParam, TRANSPARENT);
			return (INT_PTR)CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
			//return (BOOL)((HBRUSH)GetStockObject(NULL_BRUSH));
		}
		break;
	}

就可以将Edit中的字体设置为绿色

猜你喜欢

转载自blog.csdn.net/hu421160052/article/details/87600472
今日推荐