Borderlines around an appointment

2 posts, 0 answers
  1. Karl Golling
    Karl Golling avatar
    226 posts
    Member since:
    Jun 2005

    Posted 26 Jan 2013 Link to this post

    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
  2. Jack
    Admin
    Jack avatar
    2333 posts

    Posted 30 Jan 2013 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top