找回密码
 加入
搜索
查看: 1366|回复: 1

[AU3基础] [已解决]GuiComboBox 与 GuiComboBoxEx的区别

[复制链接]
发表于 2012-3-2 23:26:56 | 显示全部楼层 |阅读模式
本帖最后由 jamer 于 2012-3-11 23:38 编辑

今天翻查UDF,发现组合列表框管理和组合列表框管理Ex两套函数,都是一样的,就是一种是含有ex的一种是没有含有的。
我想问一下,这两种有什么区别,而我们平时又该用哪一种呢。?
发表于 2012-3-2 23:31:06 | 显示全部楼层
本帖最后由 Ycxw2008 于 2012-3-2 23:36 编辑

给楼主参考:(

Func _GUICtrlComboBox_Create($hWnd, $sText, $iX, $iY, $iWidth = 100, $iHeight = 120, $iStyle = 0x00200042, $iExStyle = 0x00000000)
        If Not IsHWnd($hWnd) Then Return SetError(1, 0, 0) ; Invalid Window handle for _GUICtrlComboBox_Create 1st parameter
        If Not IsString($sText) Then Return SetError(2, 0, 0) ; 2nd parameter not a string for _GUICtrlComboBox_Create

        Local $aText, $sDelimiter = Opt("GUIDataSeparatorChar")

        If $iWidth = -1 Then $iWidth = 100
        If $iHeight = -1 Then $iHeight = 120
        Local Const $WS_VSCROLL = 0x00200000
        If $iStyle = -1 Then $iStyle = BitOR($WS_VSCROLL, $CBS_AUTOHSCROLL, $CBS_DROPDOWN)
        If $iExStyle = -1 Then $iExStyle = 0x00000000

        $iStyle = BitOR($iStyle, $__UDFGUICONSTANT_WS_CHILD, $__COMBOBOXCONSTANT_WS_TABSTOP, $__UDFGUICONSTANT_WS_VISIBLE)

        Local $nCtrlID = __UDF_GetNextGlobalID($hWnd)
        If @error Then Return SetError(@error, @extended, 0)

        Local $hCombo = _WinAPI_CreateWindowEx($iExStyle, $__COMBOBOXCONSTANT_ClassName, "", $iStyle, $iX, $iY, $iWidth, $iHeight, $hWnd, $nCtrlID)
        _WinAPI_SetFont($hCombo, _WinAPI_GetStockObject($__COMBOBOXCONSTANT_DEFAULT_GUI_FONT))
        If StringLen($sText) Then
                $aText = StringSplit($sText, $sDelimiter)
                For $x = 1 To $aText[0]
                        _GUICtrlComboBox_AddString($hCombo, $aText[$x])
                Next
        EndIf
        Return $hCombo
EndFunc   ;==>_GUICtrlComboBox_Create



Func _GUICtrlComboBoxEx_Create($hWnd, $sText, $iX, $iY, $iWidth = 100, $iHeight = 200, $iStyle = 0x00200002, $iExStyle = 0x00000000)
        If Not IsHWnd($hWnd) Then Return SetError(1, 0, 0) ; Invalid Window handle for _GUICtrlComboBoxEx_Create 1st parameter
        If Not IsString($sText) Then Return SetError(2, 0, 0) ; 2nd parameter not a string for _GUICtrlComboBoxEx_Create

        Local $sDelimiter = Opt("GUIDataSeparatorChar")

        If $iWidth = -1 Then $iWidth = 100
        If $iHeight = -1 Then $iHeight = 200
        Local Const $WS_VSCROLL = 0x00200000
        If $iStyle = -1 Then $iStyle = BitOR($WS_VSCROLL, $CBS_DROPDOWN)
        If $iExStyle = -1 Then $iExStyle = 0x00000000

        $iStyle = BitOR($iStyle, $__UDFGUICONSTANT_WS_CHILD, $__COMBOBOXCONSTANT_WS_TABSTOP, $__UDFGUICONSTANT_WS_VISIBLE)

        Local $nCtrlID = __UDF_GetNextGlobalID($hWnd)
        If @error Then Return SetError(@error, @extended, 0)

        Local $hCombo = _WinAPI_CreateWindowEx($iExStyle, $__COMBOBOXEXCONSTANT_ClassName, "", $iStyle, $iX, $iY, $iWidth, $iHeight, $hWnd, $nCtrlID)
        _WinAPI_SetFont($hCombo, _WinAPI_GetStockObject($__COMBOBOXCONSTANT_DEFAULT_GUI_FONT))
        If StringLen($sText) Then
                Local $aText = StringSplit($sText, $sDelimiter)
                For $x = 1 To $aText[0]
                        _GUICtrlComboBoxEx_AddString($hCombo, $aText[$x])
                Next
        EndIf
        Return $hCombo
EndFunc   ;==>_GUICtrlComboBoxEx_Create
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-30 19:26 , Processed in 0.084999 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表