本帖最后由 heroxianf 于 2017-6-7 21:40 编辑
上次讨论如何鼠标悬停就激活下拉控件问题,但是遇到一个新的问题,如果两个下拉控件上下靠的太近如果展开菜单选区,鼠标滑过下面或是上面的下拉控件,就会自动缩回菜单,体验有点不好,有么有解决的办法?
或者采用鼠标右键点击控件才激活控件呢?
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <GuiComboBox.au3>
Example()
Func Example()
Local $hGUI = GUICreate("ComboBox", 300, 200)
Local $idComboBox1 = GUICtrlCreateCombo("test1", 10, 10, 185, 20, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $CBS_DROPDOWNLIST))
Local $idComboBox2 = GUICtrlCreateCombo("中文1", 10, 50, 185, 20, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $CBS_DROPDOWNLIST))
Local $idClose = GUICtrlCreateButton("关闭", 210, 170, 85, 25)
GUICtrlSetData($idComboBox1, "test2|test3|test4", "test4")
GUICtrlSetData($idComboBox2, "中文2|中文3|中文4", "中文4")
GUISetState(@SW_SHOW, $hGUI)
While 1
$Info = GUIGetCursorInfo($hGUI)
If $Info[4] = $idComboBox1 Or $Info[4] = $idComboBox2 Then
GUICtrlSetState($Info[4], $GUI_FOCUS)
EndIf
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $idClose
ExitLoop
Case $idComboBox1
Case $idComboBox2
EndSwitch
WEnd
GUIDelete($hGUI)
EndFunc ;==>Example
|