Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Questions about "fonts" in QM
#2
1. CFont - I don't remember what it is, I guess something from forum. __Font is in System. It sends WM_SETFONT message to all specified controls; I guess CFont too.

2. _hfont now is undocumented. It is used in System functions. It is default dialog font handle. Another way to restore changed font - send WM_GETFONT before changing, save the handle in a thread variable, then send WM_SETFONT to restore.

3. __Font.Create has parameter templateFont. It can be a font or a special value, eg 1 is dialog font.

Macro Macro632
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 Static 0x54000000 0x0 8 8 48 12 "Normal"
;4 Static 0x54000000 0x0 8 24 48 12 "Bold"
;5 Button 0x54032000 0x0 64 24 48 14 "Change"
;6 Button 0x54032000 0x0 116 24 48 14 "Restore"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040308 "*" "" "" ""

if(!ShowDialog(dd &sub.DlgProc 0)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,;create bold font, using dialog font as template
,__Font- t_f.Create("" 0 1 0 1 4)
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 5 ;;Change
,int- t_oldFont
,if(t_oldFont=0) t_oldFont=SendDlgItemMessage(hDlg 4 WM_GETFONT 0 0)
,t_f.SetDialogFont(hDlg "4")
,
,case 6 ;;Restore
,if(t_oldFont) SendDlgItemMessage(hDlg 4 WM_SETFONT t_oldFont 1); t_oldFont=0
ret 1

To get a copy of _hfont:
__Font- t_f.Create("" 0 0 0 1)


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)