| 1 |
|
|---|
| 2 | #include <GUIConstantsEx.au3>
|
|---|
| 3 | #include <WindowsConstants.au3>
|
|---|
| 4 | #include <ButtonConstants.au3>
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 | Global $width=700, $height=580
|
|---|
| 8 | Global $styles[4][2] = [[0, "Default"], [$BS_LEFT, "Left"], [$BS_CENTER, "Center"], [$BS_RIGHT, "Right"] ]
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 | _Main()
|
|---|
| 12 |
|
|---|
| 13 | Func _Main()
|
|---|
| 14 |
|
|---|
| 15 | Local $msg
|
|---|
| 16 |
|
|---|
| 17 | GUICreate("Demo", $width, $height, 50, 10, $WS_POPUP+$WS_SYSMENU)
|
|---|
| 18 | GUISetBkColor(0x000000)
|
|---|
| 19 | GUISetFont (10, 500)
|
|---|
| 20 |
|
|---|
| 21 | CreateButtons (False, False, "Create", "Correct")
|
|---|
| 22 | CreateButtons (False, True, "Create; SetColour", "Left/Right wrong 3.3.8.1; Center/Right wrong 3.3.12.0/3.3.13.19")
|
|---|
| 23 | CreateButtons (True, False, "Create; ChangeStyle", "Correct")
|
|---|
| 24 | CreateButtons (True, True, "Create; ChangeStyle; SetColour", "Left/Right wrong 3.3.8.1; Center/Right wrong 3.3.12.0/3.3.13.19")
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 | GUICtrlSetDefBkColor(0x004040)
|
|---|
| 28 | GUICtrlSetDefColor(0xFFFFFF)
|
|---|
| 29 | CreateButtons (False, False, "SetDefColour; Create", "Left/Right wrong 3.3.8.1; Center/Right wrong 3.3.12.0/3.3.13.19")
|
|---|
| 30 | CreateButtons (False, True, "SetDefColour; Create; SetColour", "Left/Right wrong 3.3.8.1; Center/Right wrong 3.3.12.0/3.3.13.19")
|
|---|
| 31 | CreateButtons (True, False, "SetDefColour; Create; ChangeStyle", "Colours wrong 3.3.8.1/3.3.12.0/3.3.13.19")
|
|---|
| 32 | CreateButtons (True, True, "SetDefColour; Create; ChangeStyle; SetColour", "Left/Right wrong 3.3.8.1; Center/Right wrong 3.3.12.0/3.3.13.19")
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 | GUISetState()
|
|---|
| 36 | $msg = 0
|
|---|
| 37 |
|
|---|
| 38 | While $msg <> $GUI_EVENT_CLOSE
|
|---|
| 39 | $msg = GUIGetMsg ()
|
|---|
| 40 | If $msg > 0 Then ExitLoop
|
|---|
| 41 | WEnd
|
|---|
| 42 |
|
|---|
| 43 | GUIDelete()
|
|---|
| 44 |
|
|---|
| 45 | Exit
|
|---|
| 46 | EndFunc ;==>_Main
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 | Func CreateButtons ( $fChgStyle, $fChgColour, $sDesc, $sResult )
|
|---|
| 50 |
|
|---|
| 51 | Local $gx=8, $dx=Int($width/UBound($styles)), $bw=$dx-2*$gx
|
|---|
| 52 | Local $gy=3, $dy=Int($height/8), $bh=Int (($dy-5*$gy)/3)
|
|---|
| 53 | Static $y=0
|
|---|
| 54 |
|
|---|
| 55 | $y += $gy*2
|
|---|
| 56 | GUICtrlCreateButton ( $sDesc & @LF & $sResult, $gx, $y, $width-2*$gx, 2*$bh, $BS_MULTILINE )
|
|---|
| 57 | GUICtrlSetBkColor ( -1, 0x000000 )
|
|---|
| 58 | GUICtrlSetColor ( -1, 0xffffff )
|
|---|
| 59 |
|
|---|
| 60 | $y += 2*$bh+$gy
|
|---|
| 61 | For $i = 0 To UBound($styles)-1
|
|---|
| 62 | GUICtrlCreateButton ( $styles[$i][1], $gx+$i*$dx, $y, $bw, $bh, $styles[$i][0] )
|
|---|
| 63 | If $fChgStyle Then GUICtrlSetStyle ( -1, $Styles[$i][0] )
|
|---|
| 64 | If $fChgColour Then GUICtrlSetBkColor ( -1, 0x005020 )
|
|---|
| 65 | Next
|
|---|
| 66 |
|
|---|
| 67 | $y += $bh+$gy*2
|
|---|
| 68 | EndFunc ;==>CreateButtons
|
|---|