VB.NET代码:
- Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
- Dim template As New Template1
- GcMultiRow1.Template = template
- End Sub
- Private Sub GcMultiRow1_MouseClick(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles GcMultiRow1.MouseClick
- Dim row As Integer = (e.Y - GcMultiRow1.Template.ColumnHeaders(0).Height) \ GcMultiRow1.Template.Row.Height
- If row >= GcMultiRow1.RowCount Then
- row = GcMultiRow1.RowCount - 1
- End If
- GcMultiRow1.ClearSelection()
- GcMultiRow1.AddSelection(row)
- End Sub
复制代码 |