国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

Auto Complete combo Box(VB.NET Source Use API)

2024-07-10 13:02:36
字體:
來源:轉載
供稿:網友
  • 本文來源于網頁設計愛好者web開發社區http://www.html.org.cn收集整理,歡迎訪問。
  • private declare function lockwindowupdate lib "user32" (byval hwndlock as system.intptr) as long
    private structure size
        dim cx as long
        dim cy as long
    end structure
    public sub lockwindow(byval hwnd as system.intptr)
        dim lret as long
        lret = lockwindowupdate(hwnd)
    end sub
    private sub releasewindow()
        dim lret as long
        lret = lockwindowupdate(nothing)
    end sub
    private sub combodropdown(byref comboobj as combobox)
        call sendmessage(comboobj.handle, cb_showdropdown, 1, 0&)
    end sub
    private sub comboretract(byref comboobj as combobox)
        call sendmessage(comboobj.handle, cb_showdropdown, 0, 0&)
    end sub
    public function comboautocomplete(byref comboobj as combobox) as boolean
        dim lngitemnum as long
        dim lngselectedlength as long
        dim lngmatchlength as long
        dim strcurrenttext as string
        dim strsearchtext as string
        dim stypedtext as string const cb_locked = &h255
        try
            with (comboobj)
                if .text = nothing then
                    exit function
                end if
            call lockwindow(.handle)
            if ((instr(1, .text, .tag, vbtextcompare) <> 0 and len(.tag) = len(.text) - 1) or (left(.text, 1) <> left(.tag, 1) and .tag <> nothing)) and .tag <> cstr(cb_locked) then
            strsearchtext = .text
            lngselectedlength = len(strsearchtext)
            lngitemnum = .findstring(strsearchtext)
            comboautocomplete = not (lngitemnum = -1)
            if comboautocomplete then
                lngmatchlength = len(.items.item(lngitemnum)) - lngselectedlength .tag = cb_locked
                stypedtext = strsearchtext
                .text = .text & right(.items.item(lngitemnum), lngmatchlength)
                .selectionstart = lngselectedlength
                dim temp as integer temp = lngmatchlength .selectionlength = temp
                '.text = .text & right(.items.item(lngitemnum), lngmatchlength) .tag = stypedtext
            end if
            elseif .tag <> cstr(cb_locked) then
            .tag = .text
            end if
            call releasewindow()
        end with
        catch err as exception
            msgbox(err.message & err.stacktrace)
        end try
    end function
    發表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發表
    主站蜘蛛池模板: 青田县| 沐川县| 阜平县| 类乌齐县| 陕西省| 长岛县| 承德市| 荃湾区| 山西省| 玛曲县| 阿尔山市| 永城市| 皮山县| 那坡县| 白河县| 类乌齐县| 天峨县| 平武县| 阿尔山市| 葫芦岛市| 万全县| 赤壁市| 长垣县| 西乌珠穆沁旗| 玉屏| 自治县| 务川| 吉安市| 南岸区| 永丰县| 磴口县| 古丈县| 南阳市| 藁城市| 威海市| 广安市| 茶陵县| 崇州市| 康保县| 松溪县| 桐城市|