#Region "搜索框的全选"
@H_404_18@ Dim counter As Integer = 0 '点击次数
@H_404_18@ Dim isSelectAll As Boolean = False '是否全选
@H_404_18@ Dim selectPoint As Integer = 0@H_404_18@ '当前光标位置
@H_404_18@ Private Sub TextBox1_Click(ByVal sender As Object,ByVal e As System.EventArgs) Handles TextBox1.Click
@H_404_18@ counter += 1
@H_404_18@ If counter = 1 Then '判断是否首次点击
@H_404_18@ selectPoint = TextBox1.SelectionStart
@H_404_18@ TextBox1.SelectAll()
@H_404_18@ isSelectAll = True
@H_404_18@ ElseIf counter > 1 Then
@H_404_18@ If TextBox1.SelectionLength = 0 Then '判断选择字符的长度是否为0
@H_404_18@ If TextBox1.SelectionStart = selectPoint Then '判断是否点击上次同一位置
@H_404_18@ If isSelectAll = True Then
@H_404_18@ isSelectAll = False
@H_404_18@ Else
@H_404_18@ TextBox1.SelectAll()
@H_404_18@ @H_404_18@isSelectAll = True
@H_404_18@ End If
@H_404_18@ Else
@H_404_18@ If TextBox1.SelectionStart = TextBox1.TextLength AndAlso isSelectAll = False Then '判断光标位置在最末
@H_404_18@ TextBox1.SelectAll()
@H_404_18@ isSelectAll = True
@H_404_18@ Else
@H_404_18@ selectPoint = TextBox1.SelectionStart '不是上次同一位置,则记录当前位置
@H_404_18@ isSelectAll = False
@H_404_18@ End If
@H_404_18@ End If
@H_404_18@ End If
@H_404_18@ End If
@H_404_18@ End Sub
@H_404_18@ Private Sub TextBox1_LostFocus(ByVal sender As Object,ByVal e As System.EventArgs) Handles TextBox1.LostFocus
@H_404_18@ counter = 0
@H_404_18@ End Sub
@H_404_18@ Private Sub TextBox1_DoubleClick(ByVal sender As Object,ByVal e As System.EventArgs) Handles TextBox1.DoubleClick
@H_404_18@ isSelectAll = True
@H_404_18@ End Sub
#End Region