1 | ;; AUTOIT TARGET VERSION: Beta 3.2.11.1 |
---|
2 | ;; Summary: Auto resize of GUICtrlCreateGraphic control notify area. (?) |
---|
3 | |
---|
4 | #include <GuiConstantsEx.au3> ;; <-> (Gui Event Const) |
---|
5 | #include <WindowsConstants.au3> ;; <-> (Gui Create Const) |
---|
6 | #include <Constants.au3> ;; <-> ($COLOR_*) |
---|
7 | #include <StaticConstants.au3> ;; <-> ($SS_BLACKFRAME) |
---|
8 | |
---|
9 | Opt('MustDeclareVars', 1) |
---|
10 | Opt("GUIOnEventMode", 0) |
---|
11 | |
---|
12 | ;~ Global $hGUI |
---|
13 | Global Const $_X = 0 |
---|
14 | Global Const $_Y = 1 |
---|
15 | Global Const $_Margin = 10 |
---|
16 | |
---|
17 | _Main() |
---|
18 | |
---|
19 | Func _Main() |
---|
20 | Local $hGUI = GUICreate('GUI_Main', 200, 200, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX)) |
---|
21 | AddGraphControle($hGUI) |
---|
22 | AddFakeNotifyArea($hGUI) |
---|
23 | GUISetState(@SW_SHOW, $hGUI) |
---|
24 | GUI_Event($hGUI) |
---|
25 | EndFunc ;==>_Main |
---|
26 | |
---|
27 | Func AddGraphControle($hGUI) |
---|
28 | Local $Size_A = WinGetClientSize($hGUI) |
---|
29 | Local $GRAP_ID = GUICtrlCreateGraphic(0 + $_Margin, 0 + $_Margin, $Size_A[$_X] - ($_Margin * 2), $Size_A[$_Y] - ($_Margin * 2)) |
---|
30 | GUICtrlSetColor($GRAP_ID, $COLOR_BLUE) |
---|
31 | GUICtrlSetBkColor($GRAP_ID, $COLOR_WHITE) |
---|
32 | ConsoleWrite('+ $GRAP_ID = ' & $GRAP_ID & @CR) |
---|
33 | EndFunc ;==>AddGraphControle |
---|
34 | |
---|
35 | Func AddFakeNotifyArea($hGUI) |
---|
36 | Local $Size_A = WinGetClientSize($hGUI) |
---|
37 | Local $LABEL_ID = GUICtrlCreateLabel('', 0 + $_Margin, 0 + $_Margin, $Size_A[$_X] - ($_Margin * 2), $Size_A[$_Y] - ($_Margin * 2)) |
---|
38 | GUICtrlSetStyle($LABEL_ID, $SS_BLACKFRAME) |
---|
39 | GUICtrlSetState($LABEL_ID, $GUI_DISABLE) |
---|
40 | ConsoleWrite('+ $LABEL_ID = ' & $LABEL_ID & @CR) |
---|
41 | EndFunc ;==>AddFakeNotifyArea |
---|
42 | |
---|
43 | Func GUI_Event($hGUI) |
---|
44 | Local $Msg_Cur |
---|
45 | Local $Msg_Last |
---|
46 | While 1 |
---|
47 | $Msg_Cur = GUIGetMsg() |
---|
48 | If $Msg_Cur And ($Msg_Cur <> $Msg_Last) Then BD_GUIGetMsg($Msg_Cur, $Msg_Last) ;; |
---|
49 | Select |
---|
50 | Case $Msg_Cur = $GUI_EVENT_CLOSE ;; exit |
---|
51 | GUIDelete() |
---|
52 | Exit |
---|
53 | EndSelect |
---|
54 | WEnd |
---|
55 | EndFunc ;==>GUI_Event |
---|
56 | |
---|
57 | Func BD_GUIGetMsg($msg_new, ByRef $Msg_Last) |
---|
58 | If ($msg_new = $Msg_Last) Then Return |
---|
59 | $Msg_Last = $msg_new |
---|
60 | Switch $msg_new |
---|
61 | Case $GUI_EVENT_MOUSEMOVE |
---|
62 | ConsoleWrite(' $msg_new = $GUI_EVENT_MOUSEMOVE[' & $msg_new & ']' & @CR) |
---|
63 | Case $GUI_EVENT_MINIMIZE |
---|
64 | ConsoleWrite(' $msg_new = $GUI_EVENT_MINIMIZE[' & $msg_new & ']' & @CR) |
---|
65 | Case $GUI_EVENT_RESTORE |
---|
66 | ConsoleWrite(' $msg_new = $GUI_EVENT_RESTORE[' & $msg_new & ']' & @CR) |
---|
67 | Case $GUI_EVENT_MAXIMIZE |
---|
68 | ConsoleWrite(' $msg_new = $GUI_EVENT_MAXIMIZE[' & $msg_new & ']' & @CR) |
---|
69 | Case $GUI_EVENT_PRIMARYDOWN |
---|
70 | ConsoleWrite(' $msg_new = $GUI_EVENT_PRIMARYDOWN[' & $msg_new & ']' & @CR) |
---|
71 | Case $GUI_EVENT_PRIMARYUP |
---|
72 | ConsoleWrite(' $msg_new = $GUI_EVENT_PRIMARYUP[' & $msg_new & ']' & @CR) |
---|
73 | Case $GUI_EVENT_SECONDARYDOWN |
---|
74 | ConsoleWrite(' $msg_new = $GUI_EVENT_SECONDARYDOWN[' & $msg_new & ']' & @CR) |
---|
75 | Case $GUI_EVENT_SECONDARYUP |
---|
76 | ConsoleWrite(' $msg_new = $GUI_EVENT_SECONDARYUP[' & $msg_new & ']' & @CR) |
---|
77 | Case $GUI_EVENT_RESIZED |
---|
78 | ConsoleWrite(' $msg_new = $GUI_EVENT_RESIZED[' & $msg_new & ']' & @CR) |
---|
79 | Case $GUI_EVENT_DROPPED |
---|
80 | ConsoleWrite(' $msg_new = $GUI_EVENT_DROPPED[' & $msg_new & ']' & @CR) |
---|
81 | Case $GUI_EVENT_PRIMARYDOWN |
---|
82 | ConsoleWrite(' $msg_new = $GUI_EVENT_PRIMARYDOWN[' & $msg_new & ']' & @CR) |
---|
83 | Case $GUI_EVENT_CLOSE |
---|
84 | ConsoleWrite(' $msg_new = $GUI_EVENT_CLOSE[' & $msg_new & ']' & @CR) |
---|
85 | Case Else |
---|
86 | ConsoleWrite(' $msg_new = (controle)[' & $msg_new & ']' & @CR) |
---|
87 | EndSwitch |
---|
88 | EndFunc ;==>BD_GUIGetMsg |
---|
89 | |
---|
90 | ;; EOF ;; |
---|