国产探花免费观看_亚洲丰满少妇自慰呻吟_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
    發表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發表
    主站蜘蛛池模板: 区。| 彭水| 韶山市| 临澧县| 南充市| 会同县| 敖汉旗| 调兵山市| 泌阳县| 久治县| 当阳市| 商城县| 武定县| 雷州市| 墨竹工卡县| 汉沽区| 菏泽市| 岳普湖县| 西安市| 江油市| 通渭县| 灌南县| 许昌市| 宁乡县| 昌乐县| 西乌珠穆沁旗| 棋牌| 故城县| 堆龙德庆县| 普定县| 金山区| 施甸县| 神农架林区| 广丰县| 琼中| 襄汾县| 台安县| 天门市| 古田县| 左云县| 万盛区|