以下是引用sych在2024-4-28 11:34:55的发言:
**代码就是上面网站里的
**不知道默认字体大小在哪里设置?
clea
DECLARE INTEGER ChooseFont IN comdlg32 STRING @lpcf
DECLARE INTEGER GlobalFree IN kernel32 INTEGER hMem
DECLARE INTEGER GlobalAlloc IN kernel32;
INTEGER wFlags,;
INTEGER dwBytes
#DEFINE LF_FACESIZE 32
#DEFINE FW_NORMAL 400
#DEFINE DEFAULT_CHARSET 1
#DEFINE OUT_DEFAULT_PRECIS 0
#DEFINE CLIP_DEFAULT_PRECIS 0
#DEFINE DEFAULT_QUALITY 0
#DEFINE DEFAULT_PITCH 0
#DEFINE CF_SCREENFONTS 1
#DEFINE CF_INITTOLOGFONTSTRUCT 64
#DEFINE CF_EFFECTS 256
#DEFINE CF_FORCEFONTEXIST 65536
LOCAL lcChooseFont, lcLogFont, hLogFont, lcFontFace
lcLogFont = bintoc(16,"rs") +;
bintoc(0,"rs") +;
bintoc(0,"rs") +;
bintoc(0,"rs") +;
bintoc(FW_NORMAL,"rs") +; &&粗体900,常规400
Chr(0) +; &&斜体
Chr(0) +; &&下划线
Chr(0) +; &&删除线
Chr(DEFAULT_CHARSET) +;
Chr(OUT_DEFAULT_PRECIS) +;
Chr(CLIP_DEFAULT_PRECIS) +;
Chr(DEFAULT_QUALITY) +;
Chr(DEFAULT_PITCH) +;
PADR("Times New Roman"+Chr(0),32) &&字体名称
lnLogFontSize = 60
hLogFont = GlobalAlloc(0, lnLogFontSize)
= SYS(2600,hLogFont, lnLogFontSize, lcLogFont)
lcChooseFont = bintoc(60,"rs") +;
bintoc(0,"rs") +;
bintoc(0,"rs") +;
bintoc(hLogFont-2^31,"r") +;
BINTOC(4000,"rs") +; &&字体大小,好像是这里但没起作用
bintoc(CF_SCREENFONTS + CF_EFFECTS +CF_INITTOLOGFONTSTRUCT + CF_FORCEFONTEXIST,"rs") +;
bintoc(RGB(255,0,0),"rs") +; &&颜色
bintoc(0,"rs") +;
bintoc(0,"rs") +;
bintoc(0,"rs") +;
bintoc(0,"rs") +;
bintoc(0,"rs") +;
bintoc(0,"rs") +;
bintoc(0,"rs") +;
bintoc(0,"rs")
IF ChooseFont (@lcChooseFont) <> 0
lcLogFont=SYS(2600,hLogFont, lnLogFontSize)
? "*** CHOOSEFONT Structure:"
? "Point size:", CTOBIN(SUBSTR(lcChooseFont, 17,4),"rs")/10
? "RGB color: ", ctobin(SUBSTR(lcChooseFont, 25,4),"rs")
?
? "*** LOGFONT Structure:"
? "Font Weight:", ctobin(SUBSTR(lcLogFont, 17,4),"rs")
? "Italic: ", Iif(Asc(SUBSTR(lcLogFont, 21,1))=0, "No","Yes")
? "Underline: ", Iif(Asc(SUBSTR(lcLogFont, 22,1))=0, "No","Yes")
? "Strikeout: ", Iif(Asc(SUBSTR(lcLogFont, 23,1))=0, "No","Yes")
lcFontFace = SUBSTR(lcLogFont, 29)
lcFontFace = SUBSTR(lcFontFace, 1, AT(Chr(0),lcFontFace)-1)
? "Font Face: ", lcFontFace
ENDIF
= GlobalFree (hLogFont)
RETURN
**不知道默认字体大小在哪里设置?
我测试的结果:粗体为啥是700呢?