Ticket #155: Graphic_Controle_Notify.au3

File Graphic_Controle_Notify.au3, 3.2 KB (added by M.v.Gulik, 16 years ago)

Auto resize of GUICtrlCreateGraphic control notify area.

Line 
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
9Opt('MustDeclareVars', 1)
10Opt("GUIOnEventMode", 0)
11
12;~ Global $hGUI
13Global Const $_X = 0
14Global Const $_Y = 1
15Global Const $_Margin = 10
16
17_Main()
18
19Func _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)
25EndFunc   ;==>_Main
26
27Func 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)
33EndFunc   ;==>AddGraphControle
34
35Func 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)
41EndFunc   ;==>AddFakeNotifyArea
42
43Func 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
55EndFunc   ;==>GUI_Event
56
57Func 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
88EndFunc   ;==>BD_GUIGetMsg
89
90;; EOF ;;