|
サンプルコード
次のコードは、行に配置されたボタン型セルをクリックしたときの処理を行います。
Imports GrapeCity.Win.MultiRow Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim ButtonCell1 As New ButtonCell() ButtonCell1.Name = "ButtonCell1" ButtonCell1.Value = "ButtonCell1" Dim Template1 As Template = Template.CreateGridTemplate(New Cell() {ButtonCell1}) GcMultiRow1.Template = Template1 GcMultiRow1.RowCount = 10 End Sub Private Sub GcMultiRow1_CellContentButtonClick(sender As Object, e As GrapeCity.Win.MultiRow.CellEventArgs) Handles GcMultiRow1.CellContentButtonClick Dim gcMultiRow As GcMultiRow = TryCast(sender, GcMultiRow) If e.Scope = CellScope.Row Then MessageBox.Show(gcMultiRow(e.RowIndex, e.CellIndex).Name) End If End Sub End Sub
using GrapeCity.Win.MultiRow; private void Form1_Load(object sender, EventArgs e) { ButtonCell buttonCell1 = new ButtonCell(); buttonCell1.Name = "buttonCell1"; buttonCell1.Value = "buttonCell1"; Template template1 = Template.CreateGridTemplate(new Cell[] { buttonCell1 }); gcMultiRow1.Template = template1; gcMultiRow1.RowCount = 10; gcMultiRow1.CellContentButtonClick += new EventHandler<CellEventArgs>(gcMultiRow1_CellContentButtonClick); } private void gcMultiRow1_CellContentButtonClick(object sender, CellEventArgs e) { GcMultiRow gcMultiRow = sender as GcMultiRow; if (e.Scope == CellScope.Row) { MessageBox.Show(gcMultiRow[e.RowIndex, e.CellIndex].Name); } }