- Imports GrapeCity.Win.MultiRow
- Public Class Form1
- Private GcMultiRow1 As GcMultiRow
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
- Dim lbl As Label = New Label
- lbl.Text = "Step1:Set Postion. Step2:ClearRow. Step3:AddRow"
- lbl.Width = 300
- Me.Controls.Add(lbl)
- Dim btnStep1 As Button = New Button
- btnStep1.Text = "Step1"
- btnStep1.Location = New Point(0, lbl.Height)
- AddHandler btnStep1.Click, AddressOf btnStep1_Click
- Me.Controls.Add(btnStep1)
- Dim btnStep2 As Button = New Button
- btnStep2.Text = "Step2"
- btnStep2.Location = New Point(btnStep1.Width, btnStep1.Location.Y)
- AddHandler btnStep2.Click, AddressOf btnStep2_Click
- Me.Controls.Add(btnStep2)
- Dim btnStep3 As Button = New Button
- btnStep3.Text = "Step3"
- btnStep3.Location = New Point(btnStep1.Width + btnStep2.Width, btnStep1.Location.Y)
- AddHandler btnStep3.Click, AddressOf btnStep3_Click
- Me.Controls.Add(btnStep3)
- GcMultiRow1 = New GcMultiRow
- Me.GcMultiRow1.AllowUserToAddRows = False
- Me.GcMultiRow1.AllowUserToDeleteRows = False
- Me.GcMultiRow1.Location = New Point(0, lbl.Height + btnStep1.Height)
- Dim tmpl As Template = New Template
- Dim cell1 As InputMan.GcTextBoxCell = New InputMan.GcTextBoxCell
- Dim cell2 As InputMan.GcTextBoxCell = New InputMan.GcTextBoxCell
- cell2.Location = New Point(cell1.Width, 0)
- tmpl.Row.Cells.Add(cell1)
- tmpl.Row.Cells.Add(cell2)
- tmpl.Row.Height = cell1.Height
- tmpl.Width = cell1.Width * 2
- GcMultiRow1.Template = tmpl
- GcMultiRow1.RowCount = 3
- Me.Controls.Add(GcMultiRow1)
- GcMultiRow1.CurrentCell.Value = "InitCellPosition"
- End Sub
- Private Sub btnStep1_Click()
- If GcMultiRow1.RowCount > 1 Then
- GcMultiRow1.CurrentCellPosition = New CellPosition(1, 1)
- GcMultiRow1.CurrentCell.Value = "Step1CellPosition"
- End If
- End Sub
- Private Sub btnStep2_Click()
- GcMultiRow1.RowCount = 0
- End Sub
- Private Sub btnStep3_Click()
- GcMultiRow1.RowCount = 3
- GcMultiRow1.CurrentCell.Value = "Step3CellPosition"
- End Sub
-
- End Class
复制代码 画面初始焦点在0,0
step1设置焦点为1,1
step2清行
step3再加行
加行后焦点记住了step2设置的列位置,不是初始时的0,0 |