Changing text in radscheduler print

2 posts, 0 answers
  1. JJ
    JJ avatar
    1 posts
    Member since:
    Oct 2008

    Posted 12 May 2012 Link to this post

    I am starting to use the radscheduler for one of my company's project.  I would like to change the text in the print for the appointment. I tried to change the appointment.text in the event CellPrintElementFormating without any success.  Is there a way to accomplish it?

    Thanks
    JJ
  2. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 15 May 2012 Link to this post

    Hello JJ,

    Thank you for writing.

    Not being able to change the appointments' text in the AppointmentPrintElementFormatting event is a known limitation and it will be improved with the next official release. For the time being, you can print custom text in your appointments by using the following approach:
    public Form1()
    {
        InitializeComponent();
        this.radScheduler1.AppointmentPrintElementFormatting += new PrintAppointmentEventHandler(radScheduler1_AppointmentPrintElementFormatting);
        this.radScheduler1.AppointmentPrintElementPaint += new PrintAppointmentPaintEventHandler(radScheduler1_AppointmentPrintElementPaint);
    }
     
    void radScheduler1_AppointmentPrintElementPaint(object sender, PrintAppointmentPaintEventArgs e)
    {
        Rectangle rect = e.Bounds;
        rect.Offset(e.AppointmentElement.StatusAreaWidth, 0);
        rect.Width -= e.AppointmentElement.StatusAreaWidth;
     
        string text = "The summary is " + e.AppointmentElement.Appointment.Summary;
        using(Brush brush = new SolidBrush(e.AppointmentElement.ForeColor))
        {
            e.Graphics.DrawString(text, e.AppointmentElement.Font, brush, rect);
        }
    }
     
    void radScheduler1_AppointmentPrintElementFormatting(object sender, PrintAppointmentEventArgs e)
    {
        e.AppointmentElement.DrawText = false;
    }

    I hope you find this useful. If you have any further questions, feel free to ask.

    Kind regards,
    Ivan Todorov
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top