我们推测你的MultiRow的EditMode属性是EditOnEnter。
就是当Cell获得焦点时,就进入编辑状态。
而且看你的情况,你是想要进入编辑状态之后还把所有文字选中的。
只需要处理GcMultiRow的EditingControlShowing事件,代码如下:- Private Sub g_EditingControlShowing(sender As Object, e As EditingControlShowingEventArgs)
- Dim t As TextBox = TryCast(e.Control, TextBox)
- If t IsNot Nothing Then
- If Not t.IsHandleCreated Then
- t.CreateControl()
- End If
- t.BeginInvoke(New System.Action(Function() Do
- SendKeys.Send("{END}")
- SendKeys.Send("+{HOME}")
- End Function))
- End If
- End Sub
复制代码
C#代码:- void g_EditingControlShowing(object sender, EditingControlShowingEventArgs e)
- {
- TextBox t = e.Control as TextBox;
- if (t != null)
- {
- if (!t.IsHandleCreated)
- {
- t.CreateControl();
- }
- t.BeginInvoke(new System.Action(delegate()
- {
- SendKeys.Send("{END}");
- SendKeys.Send("+{HOME}");
- }));
- }
- }
复制代码 |