作成日: 2017/07/26 最終更新日: 2017/07/26
文書種別
使用方法
詳細
MultiRowのすべてのセル編集コントロールはIEditingControlインタフェースを実装しているので、IEditingControl.GcMultiRowプロパティを通して呼び出し元のGcMultiRowコントロールにアクセスできます。
[Visual Basic]
[C#]
[Visual Basic]
Imports GrapeCity.Win.MultiRow Private Sub GcMultiRow1_EditingControlShowing(ByVal sender As System.Object, ByVal e As GrapeCity.Win.MultiRow.EditingControlShowingEventArgs) Handles GcMultiRow1.EditingControlShowing Dim gcMultiRow As GcMultiRow = TryCast(sender, GcMultiRow) If TypeOf e.Control Is TextBoxEditingControl Then RemoveHandler e.Control.KeyPress, AddressOf Control_KeyPress AddHandler e.Control.KeyPress, AddressOf Control_KeyPress End If End Sub Private Sub Control_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) ' セル編集コントロールのため、senderはGcMultiRowではなくTextBoxCell.EditTypeの ' コントロールになる Dim textBox As TextBoxEditingControl = TryCast(sender, TextBoxEditingControl) ' 呼び出し元のGcMultiRowコントロール Console.WriteLine(textBox.GcMultiRow.Name) End Sub
[C#]
using GrapeCity.Win.MultiRow;
private void gcMultiRow1_EditingControlShowing(object sender, EditingControlShowingEventArgs e)
{
GcMultiRow gcMultiRow = sender as GcMultiRow;
if (e.Control is TextBoxEditingControl)
{
e.Control.KeyPress -= new KeyPressEventHandler(Control_KeyPress);
e.Control.KeyPress += new KeyPressEventHandler(Control_KeyPress);
}
}
private void Control_KeyPress(object sender, KeyPressEventArgs e)
{
// セル編集コントロールのため、senderはGcMultiRowではなくTextBoxCell.EditTypeの
// コントロールになる
TextBoxEditingControl textBox = sender as TextBoxEditingControl;
// 呼び出し元のGcMultiRowコントロール
Console.WriteLine(textBox.GcMultiRow.Name);
}
旧文書番号
40545