Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change the text font in the function ShowText
#1
Hi,

I want to change the text font and font size in the function ShowText, I added the code below, but it doesn't work

Code:
Copy      Help
__Font- f.Create("Microsoft YaHei Mono" 12 0); f.SetDialogFont(hDlg "3")

Thanks in advance for any advice and help
david

Function ShowText2
Code:
Copy      Help
/Dialog_Editor
;function# $caption $text [hwndOwner] [flags] ;;flags: 1 modeless, 2 QM-format, 4 text is file.

str caption
str s.getmacro()
str text=s

int flags=2
int hwndOwner=0

str dd=
;BEGIN DIALOG
;2 "" 0x90CF0A48 0x100 0 0 350 220 ""
;3 RichEdit20W 0x54200844 0x4 0 0 350 220 ""
;2 Button 0x54000001 0x4 0 161 0 0 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "" "" "" ""

str controls = "0 3"
str Dlg Edit3

Dlg=iif(empty(caption) "QM Textbox" caption)
if(flags&4) Edit3.from("&" text); else Edit3=text

ret ShowDialog(dd &sub.DlgProc &controls hwndOwner flags&1 0 0 flags)


#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,__Font- f.Create("Microsoft YaHei Mono" 12 0); f.SetDialogFont(hDlg "3") ;;Changing the font has no effect
,
,SetFocus(id(2 hDlg))
,int flags=DT_GetParam(hDlg)
,if(flags&2) SendMessage(_hwndqm WM_USER+26 flags id(3 hDlg))
,
,case WM_COMMAND
,sel wParam
,,case [IDOK,IDCANCEL] DT_Cancel hDlg
,ret 1
,
,case WM_SIZE
,RECT r; GetClientRect(hDlg &r)
,MoveWindow(id(3 hDlg) 0 0 r.right r.bottom 1)


Messages In This Thread
Change the text font in the function ShowText - by Davider - 01-10-2023, 01:08 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)