Jump to content
Sign in to follow this  
jimg

Bold font?

Recommended Posts

jimg

I'd like to add some "bold" characters to my GUI.

$font = "Tahoma Bold"

_GDIPlus_GraphicsDrawString($hGraphic,$val, $x, $y,$font,10)

draws nothing visible. Just "Tahoma" works fine (and the fonts are installed).

I also tried the weight parameter in GUICtrlSetFont, but nothing from 0 to 40000 has any effect on the result.

Share this post


Link to post
Share on other sites
BrettF

;Include Files
#include <GuiConstantsEx.au3>
#include <GuiEdit.au3>
;Declare Variables
$iState = 0

;Start GUI Code
$GUI = GUICreate ("Test Window", 400, 300)
$LabelControl = GUICtrlCreateLabel ("This is some text... Click the button bellow to set it to bold.", 10, 10, 380, 30)
$button = GUICtrlCreateButton ("Click Me!", 10, 40, 100)
;Show GUI
GUISetState ()

;Start While loop
While 1
    $nMsg = GUIGetMsg ()
    Switch $nMsg
        Case -3; Same as $GUI_ON_EVENT_CLOSE
            Exit
        Case $button
            If $iState = 1 Then; Text is already bold, we need to return it to normal.
                GUICtrlSetFont ($LabelControl, 8.5, 400, 0, "Tahoma")
                GUICtrlSetData ($LabelControl, "This is some text... Click the button bellow to set it to bold.")
                $iState = 0
            ElseIf $iState = 0 Then;Text is not bold, we need to do that.
                GUICtrlSetFont ($LabelControl, 8.5, 800, 0, "Tahoma")
                GUICtrlSetData ($LabelControl, "This is some text... Click the button bellow to set it to normal.")
                $iState = 1
            Else; Something went wrong
                MsgBox (32, "ERROR", "SOMETHING IS VERY WRONG!")
            EndIf
    EndSwitch
WEnd

EDIT: http://www.autoitscript.com/autoit3/docs/appendix/fonts.htm

Cheers,

Brett

Edited by BrettF

Share this post


Link to post
Share on other sites
jimg

;Include Files
#include <GuiConstantsEx.au3>
#include <GuiEdit.au3>
;Declare Variables
$iState = 0

;Start GUI Code
$GUI = GUICreate ("Test Window", 400, 300)
$LabelControl = GUICtrlCreateLabel ("This is some text... Click the button bellow to set it to bold.", 10, 10, 380, 30)
$button = GUICtrlCreateButton ("Click Me!", 10, 40, 100)
;Show GUI
GUISetState ()

;Start While loop
While 1
    $nMsg = GUIGetMsg ()
    Switch $nMsg
        Case -3; Same as $GUI_ON_EVENT_CLOSE
            Exit
        Case $button
            If $iState = 1 Then; Text is already bold, we need to return it to normal.
                GUICtrlSetFont ($LabelControl, 8.5, 400, 0, "Tahoma")
                GUICtrlSetData ($LabelControl, "This is some text... Click the button bellow to set it to bold.")
                $iState = 0
            ElseIf $iState = 0 Then;Text is not bold, we need to do that.
                GUICtrlSetFont ($LabelControl, 8.5, 800, 0, "Tahoma")
                GUICtrlSetData ($LabelControl, "This is some text... Click the button bellow to set it to normal.")
                $iState = 1
            Else; Something went wrong
                MsgBox (32, "ERROR", "SOMETHING IS VERY WRONG!")
            EndIf
    EndSwitch
WEnd

EDIT: http://www.autoitscript.com/autoit3/docs/appendix/fonts.htm

Cheers,

Brett

I guess I didn't do the original experiment correctly. Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×