标签:ase hwnd return 设置字体 end nfa cpp 文本 stat
https://www.cnblogs.com/gakusei/articles/1585212.html
// “关于”框的消息处理程序。 LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { static HFONT hfont_static; // 自定义字体的句柄 static HWND hwnd_static; // Static 控件的句柄 switch (message) { case WM_INITDIALOG: // 建立自定义字体 LOGFONT lgf; GetObject(GetStockObject(DEFAULT_GUI_FONT), sizeof(lgf), &lgf); lgf.lfWeight = FW_BOLD; hfont_static = CreateFontIndirect(&lgf); // 设置字体 hwnd_static = GetDlgItem(hDlg, IDC_MYSTATIC); //*** SendMessage(hwnd_static, WM_SETFONT, (WPARAM)hfont_static, (LPARAM)TRUE); //*** return TRUE; case WM_CTLCOLORSTATIC: // 改变文本颜色和背景颜色 if((HWND)lParam == hwnd_static) { SetTextColor((HDC)wParam, 0xff0000); //*** } else { SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT)); } SetBkColor((HDC)wParam, GetSysColor(COLOR_BTNFACE)); SetWindowLong(hDlg, DWL_MSGRESULT, (LONG)TRUE); return (LRESULT)GetSysColorBrush(COLOR_BTNFACE); case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { DeleteObject(hfont_static); EndDialog(hDlg, LOWORD(wParam)); // 销毁自定义字体 return TRUE; } break; } return FALSE; }
标签:ase hwnd return 设置字体 end nfa cpp 文本 stat
原文地址:https://www.cnblogs.com/hshy/p/11640682.html