作成日: 2017/07/26 最終更新日: 2017/07/26
文書種別
使用方法
詳細
CalendarGridでは、セルの移動方法を取得できるMoveStatusプロパティを使用できます。
マウス操作でのセルの移動を禁止したい場合には、CurrentCellPositionChangingイベントを使用します。
[Visual Basic]
Imports GrapeCity.Win.CalendarGrid
Private Sub GcCalendarGrid1_CurrentCellPositionChanging(sender As Object, e As CalendarCellPositionChangingEventArgs) Handles GcCalendarGrid1.CurrentCellPositionChanging
Dim gcCalendarGrid = DirectCast(sender, GcCalendarGrid)
If e.MoveStatus = CalendarMoveStatus.MouseClick Then
e.NewCellPosition = gcCalendarGrid.CurrentCellPosition
End If
End Sub
[C#]
using GrapeCity.Win.CalendarGrid;
private void gcCalendarGrid1_CurrentCellPositionChanging(object sender, CalendarCellPositionChangingEventArgs e)
{
GcCalendarGrid gcCalendarGrid = sender as GcCalendarGrid;
if (e.MoveStatus == CalendarMoveStatus.MouseClick)
{
e.NewCellPosition = gcCalendarGrid.CurrentCellPosition;
}
}
なお、MoveStatusプロパティは、以下のイベントで使用できます。
マウス操作でのセルの移動を禁止したい場合には、CurrentCellPositionChangingイベントを使用します。
[Visual Basic]
Imports GrapeCity.Win.CalendarGrid
Private Sub GcCalendarGrid1_CurrentCellPositionChanging(sender As Object, e As CalendarCellPositionChangingEventArgs) Handles GcCalendarGrid1.CurrentCellPositionChanging
Dim gcCalendarGrid = DirectCast(sender, GcCalendarGrid)
If e.MoveStatus = CalendarMoveStatus.MouseClick Then
e.NewCellPosition = gcCalendarGrid.CurrentCellPosition
End If
End Sub
[C#]
using GrapeCity.Win.CalendarGrid;
private void gcCalendarGrid1_CurrentCellPositionChanging(object sender, CalendarCellPositionChangingEventArgs e)
{
GcCalendarGrid gcCalendarGrid = sender as GcCalendarGrid;
if (e.MoveStatus == CalendarMoveStatus.MouseClick)
{
e.NewCellPosition = gcCalendarGrid.CurrentCellPosition;
}
}
なお、MoveStatusプロパティは、以下のイベントで使用できます。
-
CellBeginEdit
CellEndEdit
CellEnter
CellLeave
CellValidated
CellValidating
CurrentCellPositionChanged
CurrentCellPositionChanging
旧文書番号
40724