?? fontcontrols.h
字號(hào):
#ifndef FONTCONTROLS_H
#define FONTCONTROLS_H
#define STRICT
#include <windows.h>
#include <commctrl.h>
#pragma comment(lib,"comctl32.lib")
#define CHANGETEXT 1000
#define CHANGEBKG 1001
#define CHANGEFONT 1002
//NEW CODE
#define NTXFONTHEIGHT(PointSize, hDC) (-MulDiv((PointSize), GetDeviceCaps(hDC, LOGPIXELSY), 72))
//
HWND main,combo,edit,button,list,stat,
changetxtcolor,changebkcolor;
HDC hdc,hdc2;
PAINTSTRUCT ps;
COLORREF backcolor = RGB(255,255,255),
textcolor = RGB(0,0,0),
currentcolor = RGB(0,0,0);
CHOOSECOLOR choosecolor;
HBRUSH hbrush;
//new stuff
HWND changefont;
HFONT currentfont;
CHOOSEFONT choosefont;
LOGFONT logfont;
void SetupChooseColor(CHOOSECOLOR *cc,COLORREF *customclrs,HWND hwnd,COLORREF &init)
{
int ca;
for(ca = 0;ca<16;ca++){*(customclrs+ca) = RGB(255,255,255);}
cc->lStructSize = sizeof(CHOOSECOLOR);
cc->hwndOwner = hwnd;
cc->rgbResult = init;
cc->lpCustColors = customclrs;
cc->Flags = CC_ANYCOLOR|CC_FULLOPEN|CC_RGBINIT;
}
//NEW CODE
void SetupChooseFont(HWND hwnd,HFONT &cfont,LOGFONT &lfont)
{
choosefont.lStructSize = sizeof(CHOOSEFONT);
choosefont.hwndOwner = hwnd;
choosefont.lpLogFont = &lfont;
choosefont.rgbColors = RGB(0,0,0);
choosefont.Flags = CF_FORCEFONTEXIST|CF_SCREENFONTS|CF_INITTOLOGFONTSTRUCT;
cfont = CreateFont(NTXFONTHEIGHT(10,GetDC(hwnd)),0,0,0,FW_REGULAR,0,0,0,ANSI_CHARSET,0,0,PROOF_QUALITY,DEFAULT_PITCH,"Tahoma");
}
void SetFont(HWND fhwnd)
{
SendMessage(fhwnd,WM_SETFONT,(WPARAM)currentfont,MAKELPARAM(true,0));
}
void UpdateFonts(void)
{
SetFont(main);
SetFont(changefont);
SetFont(combo);
SetFont(button);
SetFont(list);
SetFont(stat);
SetFont(changetxtcolor);
SetFont(changebkcolor);
SetFont(edit);
}
//
#endif
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -