子窗口控件怎么控制主窗口及如何自动关闭子窗口
1.点击子窗口控件如何能控制主窗口显示2,当子窗口失去焦点时如何自动关闭子窗口(类似Combo效果)
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=
Dim $Radios = [,,,,, _
,,,,, _
,,,,, _
,,,,, _
,,,,, _
,,,,, _
,,,,, _
,,,,, _
,,,,, _
,,, _
,,,,, _
]
Dim $i, $i_from, $i_to, $Radio
$Form1 = GUICreate("Form1", 623, 449, 226, 115)
$Label1 = GUICtrlCreateLabel("Label1", 168, 48, 55, 25, $SS_SUNKEN)
$Label2 = GUICtrlCreateLabel("Label1", 228, 48, 55, 25, $SS_SUNKEN)
$Label3 = GUICtrlCreateLabel("Label1", 287, 48, 55, 25, $SS_SUNKEN)
$Label4 = GUICtrlCreateLabel("Label1", 347, 48, 55, 25, $SS_SUNKEN)
$Label5 = GUICtrlCreateLabel("Label1", 406, 48, 55, 25, $SS_SUNKEN)
$Label6 = GUICtrlCreateLabel("Label1", 466, 48, 55, 25, $SS_SUNKEN)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Label1
AdlibRegister(_SubGUI(0, 9))
Case $Label2
AdlibRegister(_SubGUI(10, 19))
Case $Label3
AdlibRegister(_SubGUI(20, 29))
Case $Label4
AdlibRegister(_SubGUI(30, 39))
Case $Label5
AdlibRegister(_SubGUI(40, 47))
Case $Label6
AdlibRegister(_SubGUI(48, 53))
EndSwitch
WEnd
Func _SubGUI($i_from, $i_to)
$Pos = MouseGetPos()
$SubGUI = GUICreate("", 100, 270, $Pos, $Pos, $Form1)
GUISetFont(14)
For $i = $i_from To $i_to
$Radio[$i] = GUICtrlCreateRadio($Radios[$i], 0, 25 * ($i - $i_from), 90, 25)
GUICtrlSetBkColor(-1, $Radios[$i])
Next
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Radio To $Radio
GUISetBkColor($Label1, $Radios[$i])
EndSwitch
WEnd
EndFunc ;==>_SubGUI
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Global $Radios = [, , , , , _
, , , , , _
, , , , , _
, , , , , _
, , , , , _
, , , , , _
, , , , , _
, , , , , _
, , , , , _
, , , _
, , , , , _
]
Dim $i, $i_from, $i_to, $Radio
$Form1 = GUICreate("Form1", 623, 449)
$Label1 = GUICtrlCreateLabel("Label1", 168, 48, 55, 25, $SS_SUNKEN)
$Label2 = GUICtrlCreateLabel("Label1", 228, 48, 55, 25, $SS_SUNKEN)
$Label3 = GUICtrlCreateLabel("Label1", 287, 48, 55, 25, $SS_SUNKEN)
$Label4 = GUICtrlCreateLabel("Label1", 347, 48, 55, 25, $SS_SUNKEN)
$Label5 = GUICtrlCreateLabel("Label1", 406, 48, 55, 25, $SS_SUNKEN)
$Label6 = GUICtrlCreateLabel("Label1", 466, 48, 55, 25, $SS_SUNKEN)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Label1
_SubGUI(0, 9, $nMsg)
Case $Label2
_SubGUI(10, 19, $nMsg)
Case $Label3
_SubGUI(20, 29, $nMsg)
Case $Label4
_SubGUI(30, 39, $nMsg)
Case $Label5
_SubGUI(40, 47, $nMsg)
Case $Label6
_SubGUI(48, 53, $nMsg)
EndSwitch
WEnd
Func _SubGUI($i_from, $i_to , $iCtrlID)
$Pos = MouseGetPos()
$SubGUI = GUICreate("", 100, 270, $Pos, $Pos, $Form1)
GUISetFont(14)
For $i = $i_from To $i_to
$Radio[$i] = GUICtrlCreateRadio($Radios[$i], 0, 25 * ($i - $i_from), 90, 25)
GUICtrlSetBkColor(-1, $Radios[$i])
Next
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUIDelete($SubGUI)
Return
Case $Radio[$i_from] To $Radio[$i_to]
$index = $i_from +$nMsg -$Radio[$i_from]
GUICtrlsetBkColor($iCtrlID, $Radios[$index])
EndSwitch
If WinGetHandle('') <> $SubGUI Then
GUIDelete($SubGUI)
Return
EndIf
WEnd
EndFunc ;==>_SubGUI
zghwelcome 发表于 2023-9-17 23:05
虽然暂时还没看明白,但看起来好牛屁的样子... $SubGUI = GUICreate("", 100, 270, $Pos, $Pos, $Form1)两位都掉了两位参数…… afan 发表于 2023-9-18 10:14
$SubGUI = GUICreate("", 100, 270, $Pos, $Pos, $Form1)两位都掉了两位参数……
啥参数???
============
页:
[1]