PowerTools CalendarGrid for Windows Forms 1.0J
ユーザーによるクリックを処理する

Label型セルのユーザーによるクリックを処理するには、GcCalendarGrid.CellContentClickイベントを使用します。

Imports GrapeCity.Win.CalendarGrid

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Dim today As DateTime = DateTime.Today
    Dim labelCellType = New CalendarLabelCellType()
    labelCellType.Ellipsis = CalendarGridEllipsisMode.EllipsisEnd

    GcCalendarGrid1.Content(today).Rows(1).Cells(0).CellType = labelCellType.Clone()
    GcCalendarGrid1.Content(today).Rows(1).Cells(0).Value = "Label型セル"
    GcCalendarGrid1.ScrollIntoView(today)

    AddHandler GcCalendarGrid1.CellContentClick, AddressOf GcCalendarGrid1_CellContentClick
End Sub

Private Sub GcCalendarGrid1_CellContentClick(sender As Object, e As GrapeCity.Win.CalendarGrid.CalendarCellEventArgs)
    Dim today As DateTime = DateTime.Today
    Dim targetCellPosition As New CalendarCellPosition(today, 1, 0)
    Dim gcCalendarGrid As GcCalendarGrid = DirectCast(sender, GcCalendarGrid)
    If gcCalendarGrid.CurrentCellPosition = targetCellPosition Then
        MessageBox.Show("クリックされました。")
    End If
End Sub
using GrapeCity.Win.CalendarGrid;

private void Form1_Load(object sender, EventArgs e)
{
    var today = DateTime.Today;

    var labelCellType = new CalendarLabelCellType();
    labelCellType.Ellipsis = CalendarGridEllipsisMode.EllipsisEnd;

    gcCalendarGrid1.Content[today].Rows[1].Cells[0].CellType = labelCellType.Clone();
    gcCalendarGrid1.Content[today].Rows[1].Cells[0].Value = "Label型セル";
    gcCalendarGrid1.ScrollIntoView(today);

    gcCalendarGrid1.CellContentClick += gcCalendarGrid1_CellContentClick;
}

private void gcCalendarGrid1_CellContentClick(object sender, CalendarCellEventArgs e)
{
    var today = DateTime.Today;
    var targetCellPosition = new CalendarCellPosition(today, 1, 0);
    var gcCalendarGrid = sender as GcCalendarGrid;
    if (gcCalendarGrid.CurrentCellPosition == targetCellPosition)
    {
        MessageBox.Show("クリックされました。");
    }
}
参照

 

 


© 2014 GrapeCity inc. All rights reserved.