How to print a week view

4 posts, 0 answers
  1. Art
    Art avatar
    54 posts
    Member since:
    Dec 2010

    Posted 12 Mar 2013 Link to this post

    I'd like to print a week view as it appears in the application, i.e. days across the top, time slots along the side, and appointments sized and placed in those slots. I'd like it in landscape mode. Seems like it should be simple but I can't figure it out.

    Later
    Art
  2. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 15 Mar 2013 Link to this post

    Hello Art,

    Thank you for writing.

    Currenty, RadScheduler does not support such a layout mode for printing. You can see the available printing layouts in this article: http://www.telerik.com/help/winforms/scheduler-print-support-schedulerprintstyle.html.

    I have added a feature request for such in our Public Issue Tracking System. Feel free to add your vote for it here: http://www.telerik.com/support/pits.aspx#/public/winforms/14542.

    I have updated your Telerik Points for this request. 

    As a workaround I can suggest using the standard windows forms printing functionality to print the control as seen on the form. Here is a sample method:
    private void PrintControl(Control control)
           {
               var bitmap = new Bitmap(control.Width, control.Height);
     
               var pd = new PrintDocument();
               pd.DefaultPageSettings.Landscape = true;
               control.DrawToBitmap(bitmap, new Rectangle(0, 0, control.Width, control.Height));
     
               pd.PrintPage += (s, e) => e.Graphics.DrawImage(bitmap, 100, 100);
     
               PrintPreviewDialog printPreviewDialog1 = new PrintPreviewDialog();
               printPreviewDialog1.Document = pd;
     
               if (printPreviewDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
               {
                   pd.Print();
               }
           }


    All the best,
    Stefan
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Art
    Art avatar
    54 posts
    Member since:
    Dec 2010

    Posted 15 Mar 2013 Link to this post

    Do you have that example in VB.NET?
  5. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 15 Mar 2013 Link to this post

    Here you are:
    Imports System.Drawing.Printing
     
    Public Class Form1
        Dim bitmap As Bitmap
        Private Sub PrintControl(control As Control)
            bitmap = New Bitmap(control.Width, control.Height)
     
            Dim pd = New PrintDocument()
            pd.DefaultPageSettings.Landscape = True
            control.DrawToBitmap(bitmap, New Rectangle(0, 0, control.Width, control.Height))
     
            AddHandler pd.PrintPage, AddressOf PrintRange
     
            Dim printPreviewDialog1 As New PrintPreviewDialog()
            printPreviewDialog1.Document = pd
     
            If printPreviewDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
                pd.Print()
            End If
     
        End Sub
     
        Private Sub PrintRange(sender As Object, e As PrintPageEventArgs)
            e.Graphics.DrawImage(Bitmap, 100, 100)
        End Sub
     
        Private Sub RadButton1_Click(sender As System.Object, e As System.EventArgs) Handles RadButton1.Click
            PrintControl(RadScheduler1)
        End Sub
        
    End Class


    Regards,
    Stefan
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Back to Top