Sign in to follow this  
Followers 0
tehsage

GUICtrlSetFont and _ChooseFont

2 posts in this topic

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 ()
sleep(500)

changefont($label2)

Do
    $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)
EndFunc


[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  
Followers 0