As you may already know, Q1 2012 RadControls for WinForms brought to you one much requested feature- native printing support for RadGridView and RadScheduler. Utilizing its capabilities it is as easy as pie to send the data from your control to a printer by calling a single method. However, there are also a variety of options that allow you to customize the appearance of your pages. With this post, we will take a closer look at the features and options of printing that RadScheduler provides out-of-the-box.
RadPrintDocument document =
"Printed from RadScheduler"
+ RadPrintDocument.PageNumberString +
" of "
SchedulerDailyPrintStyle dailyStyle =
.radScheduler1.PrintStyle = dailyStyle;
dailyStyle.DateStartRange = DateTime.Today;
dailyStyle.DateEndRange = DateTime.Today.AddDays(5);
dailyStyle.TimeStartRange = TimeSpan.FromHours(7);
dailyStyle.TimeEndRange = TimeSpan.FromHours(19);
By setting the DateStartRange and DateEndRange properties we can pick the date range we want to print. The TimeStartRange and TimeEndRange properties stand for each day and indicate the time interval we want to print appointments from. For example, if we do not care of appointments that start later than 19 o’clock or end before 7 o’clock we can set these properties as in the above code snippet.
, 8, FontStyle.Bold);
, 10, FontStyle.Regular);
"Times New Roman"
, 16, FontStyle.Bold);
As you can see, there is a separate font property for different parts of the page.
sender, PrintSchedulerCellEventArgs e)
(e.CellElement.Date.Hour >= 12 && e.CellElement.Date.Hour < 13)
e.CellElement.BackColor = Color.OrangeRed;
Now that we are done setting up the print style, we want to preview the result. We can either preview the result in a RadPrintPreviewDialog or send it directly to your printer by using the Print method of our RadPrintDocument.
Warning: If you haven’t set the print style correctly, printing without previewing might lead to spending lots of paper :) .
RadPrintPreviewDialog previewDialog =
Now that you know how to set up a print style, you can also try using the rest of the print styles with different setting combinations. And feel free to share your feedback.
Nikolay Diyanov Diyanov is the Product Manager of the Native Mobile UI division at Progress. Delivering outstanding solutions that make developers' lives easier is his passion and the biggest reward in his work. In his spare time, Nikolay enjoys travelling around the world, hiking, sun-bathing and kite-surfing.
Find him on Twitter @n_diyanov or on LinkedIn.
Subscribe to be the first to get our expert-written articles and tutorials for developers!