Function Reference


_ChooseFont

Creates a Font dialog box that enables the user to choose attributes for a logical font

#include <Misc.au3>
_ChooseFont ( [$sFontName = "Courier New" [, $iPointSize = 10 [, $iFontColorRef = 0 [, $iFontWeight = 0 [, $bItalic = False [, $bUnderline = False [, $bStrikethru = False [, $hWndOwner = 0]]]]]]]] )

Parameters

$sFontName [optional] Default font name
$iPointSize [optional] Pointsize of font
$iFontColorRef [optional] COLORREF rgbColors
$iFontWeight [optional] Font Weight
$bItalic [optional] Italic
$bUnderline [optional] Underline
$bStrikethru [optional] Strikethru
$hWndOwner [optional] Handle to the window that owns the dialog box

Return Value

Success: an array in the following format:
    [0] - contains the number of elements
    [1] - attributes = BitOR of italic:2, undeline:4, strikeout:8
    [2] - fontname
    [3] - font size = point size
    [4] - font weight = = 0-1000
    [5] - COLORREF rgbColors
    [6] - Hex BGR Color
    [7] - Hex RGB Color
Failure: sets the @error flag to non-zero.

Example

Example 1

#include <Misc.au3>
#include <MsgBoxConstants.au3>

Local $a_vFont = _ChooseFont("Arial", 8)
If (@error) Then
        MsgBox($MB_SYSTEMMODAL, "", "Error _ChooseFont: " & @error)
Else
        MsgBox($MB_SYSTEMMODAL, "", "Font Name: " & $a_vFont[2] & @CRLF & "Size: " & $a_vFont[3] & @CRLF & "Weight: " & $a_vFont[4] & @CRLF & "COLORREF rgbColors: " & $a_vFont[5] & @CRLF & "Hex BGR Color: " & $a_vFont[6] & @CRLF & "Hex RGB Color: " & $a_vFont[7])
EndIf

Example 2

#include <Misc.au3>
#include <MsgBoxConstants.au3>

Local $a_vFont = _ChooseFont()
If (@error) Then
        MsgBox($MB_SYSTEMMODAL, "ERROR", "Error _ChooseFont: " & @error)
        Exit
Else
        MsgBox($MB_SYSTEMMODAL, "", "Font Name: " & $a_vFont[2] & @CRLF & "Size: " & $a_vFont[3] & @CRLF & "Weight: " & $a_vFont[4] & @CRLF & "COLORREF rgbColors: " & $a_vFont[5] & @CRLF & "Hex BGR Color: " & $a_vFont[6] & @CRLF & "Hex RGB Color: " & $a_vFont[7])
EndIf

Example 3

#include <Misc.au3>
#include <MsgBoxConstants.au3>

Local $a_vFont = _ChooseFont()

Local $sFontName = $a_vFont[2]
Local $iFontSize = $a_vFont[3]
Local $iColorRef = $a_vFont[5]
Local $iFontWeight = $a_vFont[4]
Local $bItalic = BitAND($a_vFont[1], 2)
Local $bUnderline = BitAND($a_vFont[1], 4)
Local $bStrikethru = BitAND($a_vFont[1], 8)
$a_vFont = _ChooseFont($sFontName, $iFontSize, $iColorRef, $iFontWeight, $bItalic, $bUnderline, $bStrikethru)
If (@error) Then
        MsgBox($MB_SYSTEMMODAL, "", "Error _ChooseFont: " & @error)
Else
        MsgBox($MB_SYSTEMMODAL, "", "Font Name: " & $a_vFont[2] & @CRLF & "Size: " & $a_vFont[3] & @CRLF & "Weight: " & $a_vFont[4] & @CRLF & "COLORREF rgbColors: " & $a_vFont[5] & @CRLF & "Hex BGR Color: " & $a_vFont[6] & @CRLF & "Hex RGB Color: " & $a_vFont[7])
EndIf