Posted 22 February 2019, 2:56 am EST
Hi,
I need to allow resizing but prevent moving the appointment to other timing when arrow keys are pressed. Please guide me to achieve this functionality in C1Schedule.
Forums Home / ComponentOne / WinForms Edition
Posted by: C_S.Kalaivanan on 22 February 2019, 2:56 am EST
Posted 22 February 2019, 2:56 am EST
Hi,
I need to allow resizing but prevent moving the appointment to other timing when arrow keys are pressed. Please guide me to achieve this functionality in C1Schedule.
Posted 25 February 2019, 12:06 am EST
Hi,
An appointment can be dragged by either dragging with a mouse or by using Arrow keys.
You can identify whether an appointment is dragged by a mouse operation by using MouseDown event.
Once you’ve identified it, you can cancel the Drop operation using BeforeAppointmentDrop event.
Here’s an example:
private void C1Schedule1_MouseDown(object sender, MouseEventArgs e)
{
if (c1Schedule1.SelectedAppointments.Count != 0)
{
// An appointment is being dragged using Mouse
_isDraggingAppointment = true;
}
}
private void C1Schedule1_BeforeAppointmentDrop(object sender, CancelAppointmentEventArgs e)
{
if (!_isDraggingAppointment)
{
e.Cancel = true;
}
}
private void C1Schedule1_MouseUp(object sender, MouseEventArgs e)
{
_isDraggingAppointment = false;
}
You can also refer to the attached sample.
Regards,
Jitender
Posted 25 February 2019, 7:01 am EST
Thanks for the reply. Its working fine for me.