InputManCellでInputManのイベントを使用するには?

文書番号 : 40550     文書種別 : 使用方法     登録日 : 2017/07/26     最終更新日 : 2017/07/26
文書を印刷する
対象製品
MultiRow for Windows Forms 10.0J
詳細
GcMultiRow.EditingControlShowingイベントでイベントハンドラをe.Controlの任意のイベントに関連付けます。

次のサンプルコードは、GcTextBox.TextChangingイベントと同じ処理をGcTextBoxEditingControl.TextChangingイベントで実装します。(GcTextBoxEditingControlクラスはGcTextBoxクラスの派生クラスです)

[Visual Basic]
Imports InputManCell = GrapeCity.Win.MultiRow.InputMan

Private Sub GcMultiRow1_EditingControlShowing(ByVal sender As System.Object, ByVal e As GrapeCity.Win.MultiRow.EditingControlShowingEventArgs) Handles GcMultiRow1.EditingControlShowing
    If TypeOf e.Control Is InputManCell.GcTextBoxEditingControl Then
        Dim gcTextBox As InputManCell.GcTextBoxEditingControl = TryCast(e.Control, InputManCell.GcTextBoxEditingControl)
        RemoveHandler gcTextBox.TextChanging, AddressOf GcTextBox_TextChanging
        AddHandler gcTextBox.TextChanging, AddressOf GcTextBox_TextChanging
    End If
End Sub

Private Sub GcTextBox_TextChanging(ByVal sender As System.Object, ByVal e As GrapeCity.Win.Editors.TextChangingEventArgs)
    Console.WriteLine(e.Result)
End Sub

[C#]
using InputManCell = GrapeCity.Win.MultiRow.InputMan;

private void gcMultiRow1_EditingControlShowing(object sender, GrapeCity.Win.MultiRow.EditingControlShowingEventArgs e)
{
    if (e.Control is InputManCell.GcTextBoxEditingControl)
    {
        InputManCell.GcTextBoxEditingControl gcTextBox = e.Control as InputManCell.GcTextBoxEditingControl;
        gcTextBox.TextChanging -= new GrapeCity.Win.Editors.TextChangingEventHandler(gcTextBox_TextChanging);
        gcTextBox.TextChanging += new GrapeCity.Win.Editors.TextChangingEventHandler(gcTextBox_TextChanging);
    }
}

private void gcTextBox_TextChanging(object sender, GrapeCity.Win.Editors.TextChangingEventArgs e)
{
    Console.WriteLine(e.Result);
}