设置控件的字体(API)

       用VS2003建立的WINDOWS APPLICATION主窗口的字体很难看,开始不知道怎么改,以为在WM_PAINT的时候设置字体就可以了,结果怎么试都不起作用,后来发现WINDOWS也是很笨的,必须每个控件单独设置字体。下面是一个static text设置字体的方法

    font1=CreateFont(14, 0, 0, 0, 100, FALSE, FALSE, 0,
                  GB2312_CHARSET, OUT_DEFAULT_PRECIS,
                  CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
                  DEFAULT_PITCH | FF_MODERN, "Arial" );

    hwdData1 = CreateWindow(TEXT("STATIC"),"Data1",WS_CHILD | WS_VISIBLE  |SS_LEFT ,50,50,50,16,hWnd,
   (HMENU)NULL,((LPCREATESTRUCT) lParam)->hInstance, NULL);
  SendMessage(hwdData1,WM_SETFONT,(WPARAM)font1,MAKELPARAM(TRUE,0));

你可能感兴趣的:(C/C++,programing,api,windows,application,null)