GrapeCity CalendarGrid for Windows Forms 2.0J
DraggingHandle プロパティ
使用例 

ドラッグハンドルの位置を示す値を取得します。
構文
Public ReadOnly Property DraggingHandle As HandlePosition
public HandlePosition DraggingHandle {get;}

プロパティ値

ドラッグハンドルの位置を示す HandlePosition 値の 1 つ。
使用例
次のサンプルコードは、このイベントを使用して予定の日付範囲を制限する方法を示します。このサンプルコードは、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 メンバ

 

 


c 2008 GrapeCity inc. All rights reserved.