Function Reference

_ChooseColor

Creates a Color dialog box that enables the user to select a color.

#include <Misc.au3>
_ChooseColor([$i_ReturnType = 0[, $i_colorref = 0[, $i_refType=0]]])

 

Parameters

$i_ReturnType Optional: determines return type
$i_colorref Optional: default selected Color
$i_refType Optional: Type of $i_colorref passed in

 

Return Value

Returns COLORREF rgbcolor if $i_refType = 0 (default)
Returns Hex BGR value if $i_refType = 1
Returns Hex RGB Color if $i_refType = 2
if error occurs, @error is set

 

Remarks

$i_ReturnType = 0 then COLORREF rgbcolor is returned (default)
$i_ReturnType = 1 then Hex BGR Color is returned
$i_ReturnType = 2 Hex RGB Color is returned

$i_colorref = 0 (default)

$i_refType = 0 then $i_colorref is COLORREF rgbcolor value (default)
$i_refType = 1 then $i_colorref is BGR hex value
$i_refType = 2 then $i_colorref is RGB hex value

 

Related

None.

 

Example


#include <Misc.au3>

Local $color

$color = _ChooseColor (0)
If (@error) Then
   MsgBox(0, "", "Error _ChooseColor: " & @error)
Else
   MsgBox(0,"_ChooseColor","COLORREF rgbColors: " & $color)
EndIf

$color = _ChooseColor (1)
If (@error) Then
   MsgBox(0, "", "Error _ChooseColor: " & @error)
Else
   MsgBox(0,"_ChooseColor","Hex BGR Color: " & $color)
EndIf

$color = _ChooseColor (2, 255) ; default color selected using COLORREF rgbcolor
If (@error) Then
   MsgBox(0, "", "Error _ChooseColor: " & @error)
Else
   MsgBox(0,"_ChooseColor","Hex RGB Color: " & $color)
EndIf

$color = _ChooseColor (2, 0x0000FF, 1) ; default color selected using BGR hex value
If (@error) Then
   MsgBox(0, "", "Error _ChooseColor: " & @error)
Else
   MsgBox(0,"_ChooseColor","Hex RGB Color: " & $color)
EndIf

$color = _ChooseColor (2, 0xFF0000, 2) ; default color selected using RGB hex value
If (@error) Then
   MsgBox(0, "", "Error _ChooseColor: " & @error)
Else
   MsgBox(0,"_ChooseColor","Hex RGB Color: " & $color)
EndIf