This is a migrated thread and some comments may be shown as answers.

Borderlines around an appointment

1 Answer 92 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 26 Jan 2013, 05:16 PM
Hello,

I use RadScheduler in my project and my appointments have custom colors, icons etc.

I've figured out there is a way to set the colored line on the left for each Appointment in the RadScheduler by setting Appointment.StatusID and constructing the needed Status structure. I wonder if there is a way to set a colored line just like the status line, but on the right side and also on the bottom of Appointment. Is there an easy way to imlement this feature? And if there isn't, then what can be the workaround?

Thank you for your support.

Karl

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 30 Jan 2013, 05:42 PM
Hi Karl,

You have two options in this case:

1. You can handle the AppointmentFormatting event and add a custom element inside the AppointmentElement. In the following example I am adding one at the bottom of the appointment and one on its right side:
void scheduler_AppointmentFormatting(object sender, SchedulerAppointmentEventArgs e)
{
    if (e.AppointmentElement.Children.Count == 0)
    {
        LightVisualElement lve = new LightVisualElement();
        lve.Alignment = ContentAlignment.BottomCenter;
        lve.MaxSize = new System.Drawing.Size(0, 6);
        lve.DrawFill = true;
        lve.BackColor = Color.Red;
        lve.GradientStyle = GradientStyles.Solid;
        lve.ShouldHandleMouseInput = false;
        lve.NotifyParentOnMouseInput = true;
        e.AppointmentElement.Children.Add(lve);
 
        LightVisualElement lve2 = new LightVisualElement();
        lve2.Alignment = ContentAlignment.MiddleRight;
        lve2.MaxSize = new Size(6, 0);
        lve2.DrawFill = true;
        lve2.BackColor = Color.Green;
        lve2.GradientStyle = GradientStyles.Solid;
        lve2.ShouldHandleMouseInput = false;
        lve2.NotifyParentOnMouseInput = true;
        e.AppointmentElement.Children.Add(lve2);
    }
}

2. The second option is to fully customize the appointment rendering by handling the AppointmentRender method. Here is a sample:
void scheduler_AppointmentRender(object sender, AppointmentRenderEventArgs args)
{
    Graphics g = (Graphics)args.Graphics.UnderlayGraphics;
    g.FillRectangle(Brushes.Red, new Rectangle(0, 0, args.RenderElement.Size.Width, args.RenderElement.Size.Height));
    args.Handled = true;
}

If you have further questions, do not hesitate to ask.

Regards,
Jack
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
Tags
Scheduler and Reminder
Asked by
Karl
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or