PowerTools MultiRow for Windows Forms 8.0J
ValueChangedイベントの使用方法

DateTimePickerCellでDateTimePicker.ValueChangedイベントと同様の処理を行うには、DateTimePickerEditingControl.ValueChangedイベントを使用します。
サンプルコード
Imports GrapeCity.Win.MultiRow

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    GcMultiRow1.Template = Template.CreateGridTemplate(New Cell() {New DateTimePickerCell()})
End Sub

Private Sub GcMultiRow1_EditingControlShowing(ByVal sender As System.Object, ByVal e As EditingControlShowingEventArgs) Handles GcMultiRow1.EditingControlShowing
    If TypeOf e.Control Is DateTimePickerEditingControl Then
        Dim dateTimePickerEditingControl1 As DateTimePickerEditingControl = TryCast(e.Control, DateTimePickerEditingControl)
        RemoveHandler dateTimePickerEditingControl1.ValueChanged, AddressOf Me.dateTimePickerEditingControl1_ValueChanged
        AddHandler dateTimePickerEditingControl1.ValueChanged, AddressOf Me.dateTimePickerEditingControl1_ValueChanged
    End If
End Sub

Private Sub dateTimePickerEditingControl1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Dim dateTimePickerEditingControl1 As DateTimePickerEditingControl = TryCast(sender, DateTimePickerEditingControl)
    Dim gcMultiRow As GcMultiRow = dateTimePickerEditingControl1.GcMultiRow

    Console.WriteLine(gcMultiRow.CurrentCellPosition.ToString())
    Console.WriteLine(dateTimePickerEditingControl1.Value.ToString())
End Sub
using GrapeCity.Win.MultiRow;

private void Form1_Load(object sender, EventArgs e)
{
    gcMultiRow1.Template = Template.CreateGridTemplate(new Cell[] { new DateTimePickerCell() });
    gcMultiRow1.EditingControlShowing += new EventHandler<EditingControlShowingEventArgs>(gcMultiRow1_EditingControlShowing);

}

private void gcMultiRow1_EditingControlShowing(object sender, EditingControlShowingEventArgs e)
{
    if (e.Control is DateTimePickerEditingControl)
    {
        DateTimePickerEditingControl dateTimePickerEditingControl1 = e.Control as DateTimePickerEditingControl;
        dateTimePickerEditingControl1.ValueChanged -= new EventHandler(dateTimePickerEditingControl1_ValueChanged);
        dateTimePickerEditingControl1.ValueChanged += new EventHandler(dateTimePickerEditingControl1_ValueChanged);
    }
}

private void dateTimePickerEditingControl1_ValueChanged(object sender, EventArgs e)
{
    DateTimePickerEditingControl dateTimePickerEditingControl1 = sender as DateTimePickerEditingControl;
    GcMultiRow gcMultiRow = dateTimePickerEditingControl1.GcMultiRow;

    Console.WriteLine(gcMultiRow.CurrentCellPosition.ToString());
    Console.WriteLine(dateTimePickerEditingControl1.Value.ToString());
}
   
参照

 

 


© 2008-2015 GrapeCity inc. All rights reserved.