PDA

View Full Version : Set FontSize on Dialog Label



dcromley
22-01-2016, 20:57
I want to use a Dialog (first time). I want to increase the FontSize on a label.
A relevant msdn Referenc (https://msdn.microsoft.com/en-us/library/system.windows.controls.Control.fontsize%28v=vs.110%29.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1)e
This reference has:
btn3.FontSize = 10.0

-- SO -- is there an API I could use for the Label FontSize?
Thanks in advance.


Uses "UI"
Global hdlg As DWord

Sub TBMain()
Dialog New Pixels, 0, "Dialog Window", 40, 30, 400, 300, 0 To hdlg
Dialog Set Color hdlg, -1, Rgb(200, 200, 100)
Control Add Label, hdlg, 1001, "Label text here", 10, 10, 180, 20
' at this point I want to set the label fontsize
Control Add Button, hDlg, 1002, "Hit me to exit", 10, 40, 180, 20 Call cb1
Dialog Show Modal hdlg
End Sub

CallBack Function cb1() As Long
Dialog End hdlg
End Function

catventure
22-01-2016, 21:14
Hi,

Maybe this topic can help you?

http://www.thinbasic.com/community/showthread.php?7792-different-font-for-a-label

catventure.

dcromley
23-01-2016, 00:59
[deleted -- a poor example]

dcromley
23-01-2016, 01:25
I didn't read your link (Petr's) carefully enough -- it is simpler, better, doesn't use CreateFont:
(I can't believe my earlier searches didn't find this -- I was using "size", I guess)

Uses "UI"

Global hDlg As DWord

Sub TBMain()
Dialog New Pixels, 0, "Dialog Window", 40, 30, 400, 300, 0 To hDlg
Dialog Set Color hDlg, -1, Rgb(240, 240, 160)
Control Add Label, hDlg, 1001, "Label One - Default", 10, 10, 180, 20
Control Add Label, hDlg, 1002, "Label Two - Whatever", 10, 40, 180, 20
Dim hFont As DWord Resource = Font_Create("Arial Black", 12)
Control Send hDlg, 1002, %WM_SETFONT, hFont, 0
Control Add Button, hDlg, 1003, "Hit me to exit", 10, 70, 180, 20 Call cbexit
Dialog Show Modal hDlg
End Sub

CallBack Function cbexit() As Long
Dialog End hDlg
End Function