PowerTools CalendarGrid for Windows Forms 1.0J
EndCellPosition プロパティ
使用例 

現在の予定の終了位置を取得します。
構文
Public ReadOnly Property EndCellPosition As CalendarCellPosition
public CalendarCellPosition EndCellPosition {get;}

プロパティ値

現在の予定の終了位置。
使用例
次のサンプルコードは、このイベントを使用して予定の日付範囲を制限する方法を示します。このサンプルコードは、CalendarAppointmentCellType クラスに示されている詳細なコード例の一部を抜粋したものです。
void gcCalendarGrid_AppointmentCellDragging(object sender, AppointmentCellDraggingEventArgs e)
{
    //The following code will make the appointment limited between 2014/1/1 and 2014/1/31, and the original appointment date cannot be changed to shorter.
    if (e.StartCellPosition.RowIndex == 1 && e.StartCellPosition.ColumnIndex == 0)
    {
        if (e.DraggingHandle == HandlePosition.Left)
        {
            if (e.TargetCellPosition.Date >= new DateTime(2014, 1, 1) && e.TargetCellPosition.Date <= e.StartCellPosition.Date)
            {
                e.AllowDrop = true;
            }
            else
            {
                e.AllowDrop = false;
            }
        }
        else if(e.DraggingHandle == HandlePosition.Right)
        {
            if (e.TargetCellPosition.Date <= new DateTime(2014, 1, 31) && e.TargetCellPosition.Date >= e.EndCellPosition.Date)
            {
                e.AllowDrop = true;
            }
            else
            {
                e.AllowDrop = false;
            }
        }
    }
}
Private Sub gcCalendarGrid_AppointmentCellDragging(sender As Object, e As AppointmentCellDraggingEventArgs)
    'The following code will make the appointment limited between 2014/1/1 and 2014/1/31, and the original appointment date cannot be changed to shorter.
    If e.StartCellPosition.RowIndex = 1 AndAlso e.StartCellPosition.ColumnIndex = 0 Then
        If e.DraggingHandle = HandlePosition.Left Then
            If e.TargetCellPosition.[Date] >= New DateTime(2014, 1, 1) AndAlso e.TargetCellPosition.[Date] <= e.StartCellPosition.[Date] Then
                e.AllowDrop = True
            Else
                e.AllowDrop = False
            End If
        ElseIf e.DraggingHandle = HandlePosition.Right Then
            If e.TargetCellPosition.[Date] <= New DateTime(2014, 1, 31) AndAlso e.TargetCellPosition.[Date] >= e.EndCellPosition.[Date] Then
                e.AllowDrop = True
            Else
                e.AllowDrop = False
            End If
        End If
    End If
End Sub
参照

AppointmentCellDraggingEventArgs クラス
AppointmentCellDraggingEventArgs メンバ

 

 


© 2014 GrapeCity inc. All rights reserved.