现有一Form,Form里面有两个MultiRow,左边的是mlsREJI,右边的是mlsReji2
画面启动后,用鼠标点击mlsReji2的第二列,会弹出一个MsgBox。
关闭MsgBox后重复上面的操作,第二次后mlsReji2的第二列的单元格处于编辑状态的时候光标移动到了第一个MR。
现在怀疑光标移动到第一个Mr的同时,第二个MR保持着编辑状态。
有没有好的办法能让光标移动到第一个MR的同时,第二个Mr的编辑状态变成选择模式。
- Public Class Mr_NewCellPositionNeeded
- Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Dim tmplate As New GrapeCity.Win.MultiRow.Template
- tmplate.Clear()
- tmplate.Width = mlsREJI.Width
- tmplate.Row.Width = tmplate.Width
- tmplate.Row.Height = 21
- tmplate.Row.Cells.Add(New GrapeCity.Win.MultiRow.InputMan.GcTextBoxCell)
- tmplate.Row.Cells.Add(New GrapeCity.Win.MultiRow.InputMan.GcNumberCell)
- tmplate.Row.Cells(1).Location = New Point(tmplate.Row.Cells(0).Size.Width, 0)
- mlsREJI.Template = tmplate
- mlsREJI.AllowUserToAddRows = False
- mlsREJI.AllowUserToResize = False
- mlsREJI.AllowUserToDeleteRows = False
- mlsREJI.AllowUserToAutoFitColumns = False
- mlsREJI.RowCount = 3
- mlsREJI.EditMode = GrapeCity.Win.MultiRow.EditMode.EditOnEnter
- With CType(mlsREJI.Template.Row.Cells(1), GrapeCity.Win.MultiRow.InputMan.GcNumberCell)
- .SideButtons.Clear()
- End With
- Dim tmplate2 As GrapeCity.Win.MultiRow.Template = tmplate.Clone
- With CType(tmplate2.Row.Cells(1), GrapeCity.Win.MultiRow.InputMan.GcNumberCell)
- Dim NumberDecimalPartDisplayField1 As GrapeCity.Win.MultiRow.InputMan.NumberDecimalPartDisplayField = New GrapeCity.Win.MultiRow.InputMan.NumberDecimalPartDisplayField()
- Dim NumberDecimalSeparatorDisplayField1 As GrapeCity.Win.MultiRow.InputMan.NumberDecimalSeparatorDisplayField = New GrapeCity.Win.MultiRow.InputMan.NumberDecimalSeparatorDisplayField()
- .SideButtons.Clear()
- NumberDecimalPartDisplayField1.MaxDigits = 0
- Dim NumberIntegerPartDisplayField1 As GrapeCity.Win.MultiRow.InputMan.NumberIntegerPartDisplayField = New GrapeCity.Win.MultiRow.InputMan.NumberIntegerPartDisplayField()
- Dim NumberSignDisplayField3 As GrapeCity.Win.MultiRow.InputMan.NumberSignDisplayField = New GrapeCity.Win.MultiRow.InputMan.NumberSignDisplayField()
- NumberIntegerPartDisplayField1.GroupSizes = New Integer() {3, 3, 0}
- NumberSignDisplayField3.PositivePattern = "元"
- .DisplayFields.Clear()
- .DisplayFields.Add(NumberIntegerPartDisplayField1)
- .DisplayFields.Add(NumberDecimalSeparatorDisplayField1)
- .DisplayFields.Add(NumberDecimalPartDisplayField1)
- .DisplayFields.Add(NumberSignDisplayField3)
- .MaxValue = 99999999
- .Fields.DecimalPart.MaxDigits = 0
- .Fields.IntegerPart.GroupSizes = New Integer() {0}
- .Fields.IntegerPart.MaxDigits = 7
- .Fields.IntegerPart.MinDigits = 1
- .Fields.SignPrefix.NegativePattern = ""
- End With
- mlsReji2.Template = tmplate2
- mlsReji2.AllowUserToAddRows = False
- mlsReji2.AllowUserToResize = False
- mlsReji2.AllowUserToDeleteRows = False
- mlsReji2.AllowUserToAutoFitColumns = False
- mlsReji2.RowCount = 3
- mlsReji2.EditMode = GrapeCity.Win.MultiRow.EditMode.EditOnEnter
- For inci As Integer = 0 To 2
- mlsReji2(inci, 0).Value = CStr(inci)
- mlsReji2(inci, 1).Value = 9999
- mlsREJI(inci, 0).Value = CStr(inci)
- mlsREJI(inci, 1).Value = "9"
- Next
- End Sub
- Private Sub mlsREJI_CellLeave(sender As Object, e As GrapeCity.Win.MultiRow.CellEventArgs) Handles mlsREJI.CellLeave
- RemoveHandler mlsREJI.CellLeave, AddressOf mlsREJI_CellLeave
- If Me.ActiveControl Is mlsREJI OrElse _
- (TypeName(Me.ActiveControl).Contains("GcTextBoxEditingControl") AndAlso CType(Me.ActiveControl, GrapeCity.Win.MultiRow.InputMan.GcTextBoxEditingControl).GcMultiRow Is mlsREJI) OrElse _
- (TypeName(Me.ActiveControl).Contains("GcNumberEditingControl") AndAlso CType(Me.ActiveControl, GrapeCity.Win.MultiRow.InputMan.GcNumberEditingControl).GcMultiRow Is mlsREJI) Then
- Else
- GrapeCity.Win.MultiRow.SelectionActions.MoveToNextCell.Execute(mlsREJI)
- mlsREJI.Focus()
- End If
- AddHandler mlsREJI.CellLeave, AddressOf mlsREJI_CellLeave
- End Sub
- Private Sub mlsREJI_NewCellPositionNeeded(sender As Object, e As GrapeCity.Win.MultiRow.NewCellPositionNeededEventArgs) Handles mlsREJI.NewCellPositionNeeded
- If e.CellIndex = 1 Then
- MsgBox("mlsREJI_NewCellPositionNeeded")
- e.NewCellPosition = New GrapeCity.Win.MultiRow.CellPosition(e.RowIndex, e.CellIndex)
- End If
- End Sub
- End Class
复制代码 |
|