回复 3楼junlingzhu2002的帖子
你想在什么时机获取这些属性?
你可以在GcMultiRow的EditingControlShowing事件里面首先拿到e.Control, 将它转换为TextBox,然后再挂TextBox的相关事件,来获取你想要的这几个属性(SelectionStart,SelectionLength)。- Public Class Form1
- Private Sub GcMultiRow1_EditingControlShowing(sender As Object, e As EditingControlShowingEventArgs) Handles GcMultiRow1.EditingControlShowing
- Dim textBox As TextBox = TryCast(e.Control, TextBox)
- If textBox IsNot Nothing Then
- AddHandler textBox.TextChanged, New EventHandler(AddressOf Me.TextBox_TextChanged)
- End If
- End Sub
- Private Sub TextBox_TextChanged(sender As Object, e As EventArgs)
- Dim textBox As TextBox = TryCast(sender, TextBox)
- Dim selectionStart = textBox.SelectionStart
- Dim selectionLength = textBox.SelectionLength
- End Sub
- End Class
复制代码 |