Jump to content
Sign in to follow this  

GUICtrlSetFont and _ChooseFont

Recommended Posts


Heh, I'd like to thank all of those who have helped me in the past. I'm hoping this'll will be one of the last things I ask. But anyway. I'm wanting the user to use _ChooseFont so set the ideal font ideas, then I want those choices to be set in the GUIEdit, but not chanign any text before hand.

So like:

Hello *change font to Arial Black*What's up?

I've been reading on _ChoeseFont, and I understand how to read each thing, but I'm clueless on how to set them in the GUIEdit.

Share this post

Link to post
Share on other sites

#include <GUIConstants.au3>
#include <Misc.au3>

GUICreate("_Choosefont / GUICtrlSetFont Test")

$label1 = GUICtrlCreateLabel ( "hello", 10,10)
$label2 = GUICtrlCreateLabel ( "what's up?", 40,10,100,100)
GUISetState ()


    $msg = GUIGetMsg()
    if $msg = $label2 then changefont($label2)
Until $msg = $GUI_EVENT_CLOSE

func changefont($controlhandle)
    $a_font = _ChooseFont ("Arial",8)
    $attributes = $a_font[1]
    $fontname = $a_font[2]
    $size = $a_font[3] 
    $weight = $a_font[4]
    $rgbColors = $a_font[5] ; not needed here
    $hexbgr = $a_font[6] ; not needed here
    $hexrbg = $a_font[7]
    GUICtrlSetFont ($controlhandle, $size , $weight ,$attributes , $fontname )
    GUICtrlSetColor ($controlhandle, $hexrbg)

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.