设置子控件字体

来源:互联网 发布:德国的gdp数据 编辑:程序博客网 时间:2024/05/22 08:08
//设置子控件字体BOOL CALLBACK SetChildFont(HWND hwnd,LPARAM hFont){SendMessage(hwnd,WM_SETFONT,(WPARAM)hFont,TRUE);return TRUE;}//主窗口建立,即WM_CREATEBOOL OnCreate(HWND hwnd,LPCREATESTRUCT lpCreateStruct){//建立字体LOGFONT LogFont;HFONT hFont;  memset(&LogFont,0,sizeof(LOGFONT));_tcscpy(LogFont.lfFaceName, _T("宋体"));  LogFont.lfHeight = 12;  hFont = CreateFontIndirect(&LogFont);//建立2个文本框edit_create_state=CreateWindow(TEXT("EDIT"),TEXT(""),WS_VISIBLE|WS_CHILD|WS_BORDER|ES_AUTOHSCROLL,0,0,0,0,hwnd,(HMENU)BOX_CREATE,lpCreateStruct->hInstance,NULL);edit_size_state=CreateWindowEx(WS_EX_CLIENTEDGE,TEXT("EDIT"),TEXT(""),WS_VISIBLE|WS_CHILD|WS_BORDER|ES_AUTOHSCROLL,0,0,0,0,hwnd,(HMENU)BOX_SIZE,lpCreateStruct->hInstance,NULL);//枚举窗口里的子控件并设置它们的字体EnumChildWindows(hwnd,SetChildFont,(LPARAM)hFont);return TRUE;}