AlmarM Posted November 21, 2007 Share Posted November 21, 2007 #include <GUIConstants.au3> #include <Misc.au3> $GUI = GUICreate("_ChooseColor() Example", 100, 100, -1, -1) $Button = GUICtrlCreateButton("Choose", 10, 10, 80, 40) $Label = GUICtrlCreateLabel("", 10, 60, 80, 30) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $Button $Choose = _ChooseColor(2) GUICtrlSetBkColor($Label, $Choose) MsgBox(0, "Color", "Hex of the color you choose: " & $Choose) EndSelect WEnd Was bored and want to make an Example ^^ Well, here it is Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Gif Posted November 21, 2007 Share Posted November 21, 2007 Find another hobby when you are bored . Link to comment Share on other sites More sharing options...
GaryFrost Posted November 22, 2007 Share Posted November 22, 2007 expandcollapse popup#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GUIConstantsEx.au3> #include <Misc.au3> Opt('MustDeclareVars', 1) _Color_Example() Func _Color_Example() Local $GUI, $Btn_COLORREF, $Btn_BGR, $Btn_RGB, $iMemo $GUI = GUICreate("_ChooseColor() Example", 400, 300) $iMemo = GUICtrlCreateEdit("", 2, 55, 396, 200, BitOR($WS_VSCROLL, $WS_HSCROLL)) GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New") $Btn_COLORREF = GUICtrlCreateButton("COLORREF", 70, 10, 80, 40) $Btn_BGR = GUICtrlCreateButton("BGR", 160, 10, 80, 40) $Btn_RGB = GUICtrlCreateButton("RGB", 250, 10, 80, 40) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Btn_COLORREF _ShowChoice($GUI, $iMemo, 0, _ChooseColor(0, 255, 0, $GUI), "COLORREF color of your choice: ") Case $Btn_BGR _ShowChoice($GUI, $iMemo, 1, _ChooseColor(1, 0x808000, 1, $GUI), "BGR Hex color of your choice: ") Case $Btn_RGB _ShowChoice($GUI, $iMemo, 2, _ChooseColor(2, 0x0080C0, 2, $GUI), "RGB Hex color of your choice: ") EndSwitch WEnd EndFunc ;==>_Color_Example Func _ShowChoice($GUI, $iMemo, $Type, $Choose, $sMessage) Local $oldOpt, $cr If $Choose <> -1 Then $oldOpt = Opt('ColorMode', 0) ;Colors are defined as RGB If $Type = 1 Then Opt('ColorMode', 1) ;Colors are defined as BGR If $Type = 0 Then ; convert COLORREF to RGB for this example $cr = Hex($Choose, 6) GUISetBkColor('0x' & StringMid($cr, 5, 2) & StringMid($cr, 3, 2) & StringMid($cr, 1, 2), $GUI) Else GUISetBkColor($Choose, $GUI) EndIf GUICtrlSetData($iMemo, $sMessage & $Choose & @CRLF, 1) Opt('ColorMode', $oldOpt) ; reset colormode Else GUICtrlSetData($iMemo, "User Canceled Selction" & @CRLF, 1) EndIf EndFunc ;==>_ShowChoice SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
SxyfrG Posted April 28, 2008 Share Posted April 28, 2008 (edited) Sorry to bring up an old topic, but is there anyway to inverse the return value of _ChooseColor() if i set the return value to RGB hex? i.e. #include <Misc.au3> $Test = _ChooseColor ( 2 ) If $Test = -1 Then Exit $Inverse = _InverseHex($Test) MsgBox ( 0, "", "Inverse of your selection equals: " & $Inverse ) Func _InverseHex($Hex) ;inverse thingy here EndFunc *EDIT* Solved it, set the return value to colorref then $RGB = Hex(BitNot($Test),6) then do the stringmid thingy and get the RGB value Edited April 28, 2008 by SxyfrG My scripts:AppLauncherTRAY - Awesome app launcher that runs from the system tray NEW VERSION! | Run Length Encoding - VERY simple compression in pure autoit | Simple Minesweeper Game - Fun little game :)My website Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now