组合框自动完成的子串 [英] ComboBox AutoComplete on SubString
问题描述
在我的WinForms应用程序之一,我有一个组合框供用户一个窗口,选择客户。
In one of my WinForms applications, I have a window with a ComboBox for the user to select a customer from.
在该列表框中的客户都是这种格式:客户ID - 客户名称,例如004540 - 罗斯文商贸
The customers in this list box are in this format : "CustomerID - CustomerName", for example "004540 - NorthWind Traders"
本机的WinForms组合框有内置的自动完成功能,它工作得很好。问题是,它只能从组合框的列表中每个项目的字符串的开头匹配,而不是从任何地方(子)
The native WinForms combobox has an autocomplete feature built-in and it works well: the problem is that it only works by matching from the beginning of the string of each item of the combobox's list and not from anywhere (substring).
我想我的用户能够做的是两种类型的客户ID或客户名称的,作为高级用户所熟悉的最CustomerIDs而新入职无论如何都会受益于能够在输入客户名称,并获得自动完成。 这意味着,其实我是想看看从列表中的最佳匹配,其中输入的文本是ComboBox项目的子字符串。
What I would like my users to be able to do is to either type of the CustomerID or CustomerName, as senior users are familiar with most CustomerIDs while new recruits would benefit from being able to type the CustomerName in and get the AutoComplete anyway. That means that I actually want to look for the best match from the list where the inputted text is a substring of the ComboBox item.
有一个解决方案,通常建议为这种情况的是创建一个隐藏的列表框,只显示用户输入的时候,但我不开心的感觉就像一个快速的黑客,而不是轻易可重复使用的,并可能看起来与行为不一致相比,标准ComboBox控件。
A solution often suggested for this kind of scenario is to create a hidden list box that only shows up when the user types, but I'm not happy with that as it feels like a quick hack and is not easily reusable, and may look and behave inconsistently compared to the standard ComboBox control.
我试着使用DroppedDown属性,以使列表出现,并且使用的SelectedIndex设置项来实现这个自己,但组合框的文本框的内容是,当我这样做复位,而我只是想在最佳匹配项目从组合框列表中突出显示(我需要的建议,而不是追加,追加模式不能真正与反正串匹配使用)。
I've tried to implement this myself using the DroppedDown property to make the list appear and use SelectedIndex to set the item but the content of the combobox's textbox is reset when I do that, while I only would like the "best matching item" to be highlighted from the ComboBox lists (I need "Suggest" and not "Append", Append-mode can not be really be used with substring-matching anyway).
我觉得必须有一个更好的办法? 如果有人知道的自定义/第三方控制的这样做,我不反对买一个无论是。
I think that there must be a better way? If anyone knows of a custom / 3rd Party control doing this, I'm not against buying one either.
感谢。
PS:我编程在C#中的WinForms,与.NET Framework 3.5的
PS: I am programming in C# for WinForms, with .Net Framework 3.5.
推荐答案
嗯,我有一些code,您可以尝试。它不是一个组合框,但它与执行为您申请修改自动完成的文本框。
Well, I have some code for you to try. Its not a combo box, but it is an autocomplete text box with modifications that perform as you are requesting.
复制code成一种新的形式。然后其他人做任何事情之前,保存和建立。然后到窗体设计器,将一个新的ClsCustomAutoCompleteTextbox到您的形式。
Copy the code into a new form. Then before doing anything else, save and build. Then go to the form designer and drag a new ClsCustomAutoCompleteTextbox onto your form.
那么你应该能够运行它。我不知道你是想C#(至少现在我知道)。尝试在VB,看看这是你想要什么,我可以将其转换为C#。
Then you should be able to run it. I do realize that you are wanting C# (At least now I realize that). Try this in VB and see if this is what you want, and I can convert it to C#.
Public Class Form1
Dim MasterList As New List(Of String)
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim L As New List(Of String)
L.Add("123123 - Bob")
L.Add("534543 - Sally")
L.Add("123123 - George")
L.Add("34213 - Happy")
MasterList = L
Me.ClsCustomAutoCompleteTextbox1.AutoCompleteList = L
End Sub
Private Sub ClsCustomAutoCompleteTextbox1_BeforeDisplayingAutoComplete(ByVal sender As Object, ByVal e As clsCustomAutoCompleteTextbox.clsAutoCompleteEventArgs) Handles ClsCustomAutoCompleteTextbox1.BeforeDisplayingAutoComplete
Dim Name As String = Me.ClsCustomAutoCompleteTextbox1.Text.ToLower
Dim Display As New List(Of String)
For Each Str As String In MasterList
If Str.ToLower.IndexOf(Name) > -1 Then
Display.Add(Str)
End If
Next
e.AutoCompleteList = Display
e.SelectedIndex = 0
End Sub
End Class
#Region "clsCustomAutoCompleteTextbox"
Public Class clsCustomAutoCompleteTextbox
Inherits TextBox
Event BeforeDisplayingAutoComplete(ByVal sender As Object, ByVal e As clsAutoCompleteEventArgs)
Event ItemSelected(ByVal sender As Object, ByVal e As clsItemSelectedEventArgs)
Public test As New List(Of String)
Public Tabs As Integer = 0
Private Function GetLastFunction(Optional ByVal Deep As Integer = 1) As System.Reflection.MethodInfo
Dim ST As New StackTrace
Dim Frame As StackFrame = ST.GetFrame(Deep)
Return Frame.GetMethod()
End Function
Private Sub TempLogStart()
'Dim Meth As System.Reflection.MethodInfo = GetLastFunction(3)
'test.Add(Now & " - " & New String(" ", Tabs * 2) & "Started " & Meth.Module.Name & "." & Meth.Name)
'Tabs += 1
End Sub
Private Sub TempLogStop()
' Dim Meth As System.Reflection.MethodInfo = GetLastFunction(3)
' Tabs -= 1
' test.Add(Now & " - " & New String(" ", Tabs * 2) & "Stopped " & Meth.Module.Name & "." & Meth.Name)
End Sub
Public Enum SelectOptions
OnEnterPress = 1
OnSingleClick = 2
OnDoubleClick = 4
OnTabPress = 8
OnRightArrow = 16
OnEnterSingleClick = 3
OnEnterSingleDoubleClicks = 7
OnEnterDoubleClick = 5
OnEnterTab = 9
'OnItemChange = 32
End Enum
Private mSelStart As Integer
Private mSelLength As Integer
Private myAutoCompleteList As New List(Of String)
Private WithEvents myLbox As New ListBox
Private WithEvents myForm As New Form
Private WithEvents myParentForm As Form
Private DontHide As Boolean = False
Private SuspendFocus As Boolean = False
Dim Args As clsAutoCompleteEventArgs
WithEvents HideTimer As New Timer()
WithEvents FocusTimer As New Timer()
Private myShowAutoCompleteOnFocus As Boolean
Private myAutoCompleteFormBorder As System.Windows.Forms.FormBorderStyle = FormBorderStyle.None
Private myOnEnterSelect As Boolean
Private mySelectionMethods As SelectOptions = (SelectOptions.OnDoubleClick Or SelectOptions.OnEnterPress)
Private mySelectTextAfterItemSelect As Boolean = True
Public Property SelectTextAfterItemSelect() As Boolean
Get
Return mySelectTextAfterItemSelect
End Get
Set(ByVal value As Boolean)
mySelectTextAfterItemSelect = value
End Set
End Property
<System.ComponentModel.Browsable(False)> _
Public Property SelectionMethods() As SelectOptions
Get
Return mySelectionMethods
End Get
Set(ByVal value As SelectOptions)
mySelectionMethods = value
End Set
End Property
Public Property OnEnterSelect() As Boolean
Get
Return myOnEnterSelect
End Get
Set(ByVal value As Boolean)
myOnEnterSelect = value
End Set
End Property
Public Property AutoCompleteFormBorder() As System.Windows.Forms.FormBorderStyle
Get
Return myAutoCompleteFormBorder
End Get
Set(ByVal value As System.Windows.Forms.FormBorderStyle)
myAutoCompleteFormBorder = value
End Set
End Property
Public Property ShowAutoCompleteOnFocus() As Boolean
Get
Return myShowAutoCompleteOnFocus
End Get
Set(ByVal value As Boolean)
myShowAutoCompleteOnFocus = value
End Set
End Property
Public ReadOnly Property Lbox() As ListBox
Get
Return myLbox
End Get
End Property
Public Property AutoCompleteList() As List(Of String)
Get
Return myAutoCompleteList
End Get
Set(ByVal value As List(Of String))
myAutoCompleteList = value
End Set
End Property
Private Sub TryHideFormWindowsDeactivated()
End Sub
Private Declare Auto Function GetForegroundWindow Lib "user32.dll" () As IntPtr
Private Declare Auto Function GetWindowThreadProcessId Lib "user32.dll" (ByVal hWnd As IntPtr, ByRef ProcessID As Integer) As Integer
Private Function IsCurProcess(ByVal P As Process) As Boolean
Dim Ptr As IntPtr = P.MainWindowHandle
End Function
Private Function AppHasFocus(Optional ByVal ExeNameWithoutExtension As String = "") As Boolean
Dim Out As Boolean = False
Dim PID As Integer = 0
TempLogStart()
If ExeNameWithoutExtension = "" Then
ExeNameWithoutExtension = Process.GetCurrentProcess.ProcessName
End If
Dim activeHandle As IntPtr = GetForegroundWindow()
Call GetWindowThreadProcessId(activeHandle, PID)
If PID > 0 Then
'For Each p As Process In Process.GetProcessesByName(ExeNameWithoutExtension)
If PID = Process.GetCurrentProcess.Id Then
Out = True
'Exit For
End If
' Next
End If
TempLogStop()
Return Out
End Function
Private Sub SaveSelects()
Me.mSelStart = Me.SelectionStart
Me.mSelLength = Me.SelectionLength
End Sub
Private Sub LoadSelects()
Me.SelectionStart = Me.mSelStart
Me.SelectionLength = Me.mSelLength
End Sub
Private Sub ShowAutoComplete()
TempLogStart()
Args = New clsAutoCompleteEventArgs()
With Args
.Cancel = False
.AutoCompleteList = Me.myAutoCompleteList
If myLbox.SelectedIndex = -1 Then
.SelectedIndex = 0
Else
.SelectedIndex = myLbox.SelectedIndex
End If
End With
RaiseEvent BeforeDisplayingAutoComplete(Me, Args)
Me.myAutoCompleteList = Args.AutoCompleteList
'If Me.myAutoCompleteList IsNot Nothing AndAlso Me.myAutoCompleteList.Count - 1 < Args.SelectedIndex Then
' Args.SelectedIndex = Me.myAutoCompleteList.Count - 1
'End If
If Not Args.Cancel AndAlso Args.AutoCompleteList IsNot Nothing AndAlso Args.AutoCompleteList.Count > 0 Then
Call DoShowAuto()
Else
Call DoHideAuto()
End If
TempLogStop()
End Sub
Private Sub DoShowAuto()
Call SaveSelects()
TempLogStart()
Static First As Boolean = True
myLbox.BeginUpdate()
Try
myLbox.Items.Clear()
myLbox.Items.AddRange(Me.myAutoCompleteList.ToArray)
Call Me.MoveLBox(Args.SelectedIndex)
Catch ex As Exception
End Try
myLbox.EndUpdate()
myParentForm = GetParentForm(Me)
If myParentForm IsNot Nothing Then
myLbox.Name = "mmmlbox" & Now.Millisecond
If myForm.Visible = False Then
myForm.Font = Me.Font
myLbox.Font = Me.Font
myLbox.Visible = True
myForm.Visible = False
myForm.ControlBox = False
myForm.Text = ""
If First Then
myForm.Width = Me.Width
myForm.Height = 200
End If
First = False
If Not myForm.Controls.Contains(myLbox) Then myForm.Controls.Add(myLbox)
myForm.FormBorderStyle = FormBorderStyle.None
myForm.ShowInTaskbar = False
With myLbox
.Dock = DockStyle.Fill
.SelectionMode = SelectionMode.One
End With
'Frm.Controls.Add(myLbox)
DontHide = True
SuspendFocus = True
myForm.TopMost = True
myForm.FormBorderStyle = Me.myAutoCompleteFormBorder
myForm.BringToFront()
Call MoveDrop()
myForm.Visible = True
myForm.Show()
Call MoveDrop()
HideTimer.Interval = 10
Me.Focus()
SuspendFocus = False
HideTimer.Enabled = True
DontHide = False
Call LoadSelects()
End If
End If
TempLogStop()
End Sub
Sub MoveDrop()
TempLogStart()
Dim Pnt As Point = New Point(Me.Left, Me.Top + Me.Height + 2)
Dim ScreenPnt As Point = Me.PointToScreen(New Point(-2, Me.Height))
'Dim FrmPnt As Point = Frm.PointToClient(ScreenPnt)
If myForm IsNot Nothing Then
myForm.Location = ScreenPnt
'myForm.BringToFront()
'myForm.Focus()
'myLbox.Focus()
'Me.Focus()
End If
TempLogStop()
End Sub
Sub DoHide(ByVal sender As Object, ByVal e As EventArgs)
TempLogStart()
Call HideAuto()
TempLogStop()
End Sub
Private Sub DFocus(Optional ByVal Delay As Integer = 10)
TempLogStart()
FocusTimer.Interval = Delay
FocusTimer.Start()
TempLogStop()
End Sub
Private Sub DoHideAuto()
TempLogStart()
myForm.Hide()
HideTimer.Enabled = False
FocusTimer.Enabled = False
TempLogStop()
End Sub
Private Sub HideAuto()
TempLogStart()
If myForm.Visible AndAlso HasLostFocus() Then
Call DoHideAuto()
End If
TempLogStop()
End Sub
Private Function HasLostFocus() As Boolean
TempLogStart()
Dim Out As Boolean
If Me.myForm Is Nothing OrElse myForm.ActiveControl IsNot Me.myLbox Then
Out = True
End If
If Me.myParentForm Is Nothing OrElse Me.myParentForm.ActiveControl IsNot Me Then
Out = True
End If
TempLogStop()
Return Out
End Function
Private Function GetParentForm(ByVal InCon As Control) As Form
TempLogStart()
Dim TopCon As Control = FindTopParent(InCon)
Dim Out As Form = Nothing
If TypeOf TopCon Is Form Then
Out = CType(TopCon, Form)
End If
TempLogStop()
Return Out
End Function
Private Function FindTopParent(ByVal InCon As Control) As Control
TempLogStart()
Dim Out As Control
If InCon.Parent Is Nothing Then
Out = InCon
Else
Out = FindTopParent(InCon.Parent)
End If
TempLogStop()
Return Out
End Function
Public Class clsAutoCompleteEventArgs
Inherits EventArgs
Private myAutoCompleteList As List(Of String)
Private myCancel As Boolean
Private mySelectedIndex As Integer
Public Property SelectedIndex() As Integer
Get
Return mySelectedIndex
End Get
Set(ByVal value As Integer)
mySelectedIndex = value
End Set
End Property
Public Property Cancel() As Boolean
Get
Return myCancel
End Get
Set(ByVal value As Boolean)
myCancel = value
End Set
End Property
Public Property AutoCompleteList() As List(Of String)
Get
Return myAutoCompleteList
End Get
Set(ByVal value As List(Of String))
myAutoCompleteList = value
End Set
End Property
End Class
Protected Overrides Sub OnKeyUp(ByVal e As System.Windows.Forms.KeyEventArgs)
TempLogStart()
TempLogStop()
MyBase.OnKeyUp(e)
Call ShowOnChar(Chr(e.KeyValue))
End Sub
Private Sub ShowOnChar(ByVal C As String)
TempLogStart()
TempLogStop()
If IsPrintChar(C) Then
Call Me.ShowAutoComplete()
End If
End Sub
Private Function IsPrintChar(ByVal C As Integer) As Boolean
TempLogStart()
TempLogStop()
Return IsPrintChar(Chr(C))
End Function
Private Function IsPrintChar(ByVal C As Byte) As Boolean
TempLogStart()
TempLogStop()
Return IsPrintChar(Chr(C))
End Function
Private Function IsPrintChar(ByVal C As Char) As Boolean
TempLogStart()
TempLogStop()
Return IsPrintChar(C.ToString)
End Function
Private Function IsPrintChar(ByVal C As String) As Boolean
TempLogStart()
If System.Text.RegularExpressions.Regex.IsMatch(C, "[^\t\n\r\f\v]") Then
Return True
Else
Return False
End If
TempLogStop()
End Function
Private Sub clsCustomAutoCompleteTextbox_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.GotFocus
TempLogStart()
If Not Me.SuspendFocus AndAlso Me.myShowAutoCompleteOnFocus AndAlso Me.myForm.Visible = False Then
Call Me.ShowAutoComplete()
End If
TempLogStop()
End Sub
Private Sub clsCustomAutoCompleteTextbox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
TempLogStart()
If Not SelectItem(e.KeyCode) Then
If e.KeyCode = Keys.Up Then
If myLbox.SelectedIndex > 0 Then
Call MoveLBox(myLbox.SelectedIndex - 1)
End If
ElseIf e.KeyCode = Keys.Down Then
Call MoveLBox(myLbox.SelectedIndex + 1)
End If
End If
TempLogStop()
End Sub
Shadows Sub SelectAll()
End Sub
Private Sub MoveLBox(ByVal Index As Integer)
TempLogStart()
Try
If Index > myLbox.Items.Count - 1 Then
Index = myLbox.Items.Count - 1
End If
myLbox.SelectedIndex = Index
Catch ex As Exception
End Try
TempLogStop()
End Sub
Private Sub clsCustomAutoCompleteTextbox_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Leave
TempLogStart()
Call DoHide(sender, e)
TempLogStop()
End Sub
Private Sub clsCustomAutoCompleteTextbox_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LostFocus
TempLogStart()
Call DoHide(sender, e)
TempLogStop()
End Sub
Private Sub clsCustomAutoCompleteTextbox_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Move
TempLogStart()
Call MoveDrop()
TempLogStop()
End Sub
Private Sub clsCustomAutoCompleteTextbox_ParentChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ParentChanged
TempLogStart()
myParentForm = GetParentForm(Me)
TempLogStop()
End Sub
Private Sub HideTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles HideTimer.Tick
TempLogStart()
Call MoveDrop()
Call DoHide(sender, e)
Static Cnt As Integer = 0
Cnt += 1
If Cnt > 300 Then
If Not AppHasFocus() Then
Call DoHideAuto()
End If
Cnt = 0
End If
TempLogStop()
End Sub
Public Overrides Property SelectedText() As String
Get
Return MyBase.SelectedText
End Get
Set(ByVal value As String)
MyBase.SelectedText = value
End Set
End Property
Public Overrides Property SelectionLength() As Integer
Get
Return MyBase.SelectionLength
End Get
Set(ByVal value As Integer)
MyBase.SelectionLength = value
End Set
End Property
Private Sub myLbox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles myLbox.Click
End Sub
Private Sub myLbox_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles myLbox.DoubleClick
End Sub
Private Function SelectItem(Optional ByVal Key As Keys = Keys.None, _
Optional ByVal SingleClick As Boolean = False, _
Optional ByVal DoubleClick As Boolean = False) As Boolean
TempLogStart()
Dim DoSelect As Boolean = True
Dim Meth As SelectOptions
Static LastItem As Integer = -1
Select Case True
Case Me.mySelectionMethods And SelectOptions.OnEnterPress AndAlso Key = Keys.Enter
Meth = SelectOptions.OnEnterPress
Case Me.mySelectionMethods And SelectOptions.OnRightArrow AndAlso Key = Keys.Right
Meth = SelectOptions.OnRightArrow
Case Me.mySelectionMethods And SelectOptions.OnTabPress AndAlso Key = Keys.Tab
Meth = SelectOptions.OnTabPress
Case Me.mySelectionMethods And SelectOptions.OnSingleClick AndAlso SingleClick
Meth = SelectOptions.OnSingleClick
Case Me.mySelectionMethods And SelectOptions.OnDoubleClick AndAlso DoubleClick
Meth = SelectOptions.OnDoubleClick
'Case Me.mySelectionMethods And SelectOptions.OnItemChange AndAlso (LastItem <> myLbox.SelectedIndex)
Case Else
DoSelect = False
End Select
LastItem = myLbox.SelectedIndex
If DoSelect Then
Call DoSelectItem(Meth)
End If
TempLogStop()
Return DoSelect
End Function
Private Sub DoSelectItem(ByVal Method As SelectOptions)
TempLogStart()
If Me.myLbox.Items.Count > 0 AndAlso Me.myLbox.SelectedIndex > -1 Then
Dim Value As String = Me.myLbox.SelectedItem.ToString
Dim Orig As String = Me.Text
Me.Text = Value
If mySelectTextAfterItemSelect Then
Try
Me.SelectionStart = Orig.Length
Me.SelectionLength = Value.Length - Orig.Length
Catch ex As Exception
End Try
Else
'Me.SelectionStart = Me.Text.Length
'Me.SelectionLength = 0
End If
RaiseEvent ItemSelected(Me, New clsItemSelectedEventArgs(Me.myLbox.SelectedIndex, Method, Value))
Call Me.DoHideAuto()
End If
TempLogStop()
End Sub
Public Class clsItemSelectedEventArgs
Private myIndex As Integer
Private myMethod As SelectOptions
Private myItemText As String
Public Property ItemText() As Boolean
Get
Return myItemText
End Get
Set(ByVal value As Boolean)
myItemText = value
End Set
End Property
Public Property Method() As SelectOptions
Get
Return myMethod
End Get
Set(ByVal value As SelectOptions)
myMethod = value
End Set
End Property
Public Property Index() As Integer
Get
Return myIndex
End Get
Set(ByVal value As Integer)
myIndex = value
End Set
End Property
Sub New()
End Sub
Sub New(ByVal Index As Integer, ByVal Method As SelectOptions, ByVal ItemText As String)
myIndex = Index
myMethod = Method
myItemText = ItemText
End Sub
End Class
Private Sub myLbox_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles myLbox.GotFocus
TempLogStart()
Call DFocus()
TempLogStop()
End Sub
Private Sub myLbox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles myLbox.KeyDown
TempLogStart()
Call SelectItem(e.KeyCode)
TempLogStop()
End Sub
Private Sub ProcessKeyEvents(ByVal e As KeyEventArgs)
TempLogStart()
Select Case e.KeyCode
Case Is >= Keys.A And e.KeyCode <= Keys.Z
MyBase.OnKeyUp(e)
Case Keys.Back
Case Keys.Enter
Case Keys.Left, Keys.Right, Keys.Up, Keys.Down
Case Is >= Keys.NumPad0 And e.KeyCode <= Keys.NumPad9, Is >= Keys.D0 And e.KeyCode <= Keys.D9
End Select
TempLogStop()
End Sub
Private Sub myLbox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles myLbox.KeyPress
If IsPrintChar(e.KeyChar) Then
'Me.OnKeyPress(e)
'Call MoveDrop()
End If
TempLogStop()
End Sub
Private Sub myLbox_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles myLbox.KeyUp
If IsPrintChar(e.KeyValue) Then
'Me.OnKeyUp(e)
'Call MoveDrop()
End If
TempLogStop()
End Sub
Private Sub myLbox_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles myLbox.LostFocus
TempLogStart()
Call DoHide(sender, e)
TempLogStop()
End Sub
Private Sub myLbox_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles myLbox.MouseClick
TempLogStart()
'If e.Button <> Windows.Forms.MouseButtons.None Then
Call SelectItem(SingleClick:=True)
'End If
TempLogStop()
End Sub
Private Sub myLbox_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles myLbox.MouseDoubleClick
TempLogStart()
'If e.Button <> Windows.Forms.MouseButtons.None Then
Call SelectItem(DoubleClick:=True)
'End If
TempLogStop()
End Sub
Private Sub myForm_Deactivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles myForm.Deactivate
TempLogStart()
Call TryHideFormWindowsDeactivated()
TempLogStop()
End Sub
Private Sub myParentForm_Deactivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles myParentForm.Deactivate
TempLogStart()
Call TryHideFormWindowsDeactivated()
TempLogStop()
End Sub
Private Sub FocusTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles FocusTimer.Tick
TempLogStart()
Me.Focus()
TempLogStop()
End Sub
Public Sub New()
End Sub
Private Sub myLbox_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles myLbox.MouseDown
myLbox_MouseClick(sender, e)
End Sub
End Class
#End Region
这篇关于组合框自动完成的子串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!