Printing colour or greyscale charts with a zoom function

3 posts, 0 answers
  1. Gustav Mulder
    Gustav Mulder avatar
    5 posts
    Member since:
    Jul 2009

    Posted 04 May 2010 Link to this post


    RadControls version

    2009 Q3

    .NET version


    Visual Studio version

    2008 SP1

    programming language


    The RadChart does not have a print method directly on the control.  We have created a print method that will use a zoom window to ensure that the chart will fit on a standard A4 size page.  This is customizable offcourse.  Firstly we will use the RadChart component to generate a graph, then the printer settings and page settings will be set.  We clone the RadChart and set the size to fit on the page.  If this is not done, the WYSIWYG view of chart will not fit onto the page.  Hence the zoom control.  We then give the user the option to print in color or greyscale as many of our customers have asked for this feature.  This is my first code article, so please excuse if it is not in the correct format etc.

    Here is the code:

    public static void PrintChart(RadChart chart)   
                    PrinterSettings prtSettings = new PrinterSettings();  
                    PageSettings pgSettings = new PageSettings();  
                    pgSettings.Landscape = true;  
                    pgSettings.PaperSize = new PaperSize("A4", 827, 1169);  
                    RadChart zoom = (RadChart)chart.Clone();  
                    zoom.Size = new Size(305, 200);  
                    switch (MessageBox.Show("Would you like to print the chart in colour?", "Chart Print Options", MessageBoxButtons.YesNoCancel))  
                        case DialogResult.Yes:  
                                zoom.Printing.PrintChart(prtSettings, pgSettings, ChartPrintOptions.ShowPrinterSelectDialog);  
                        case DialogResult.No:  
                                ChartOperations.ApplyChartSkin(zoom, types.ChartSkins.GreyScale);  
                                zoom.Printing.PrintChart(prtSettings, pgSettings, ChartPrintOptions.ShowPrinterSelectDialog);  
                catch (Exception ex)  
                    throw new Exception("(PrintChart)" + ex.Message);  
  2. Ves
    Ves avatar
    2926 posts

    Posted 06 May 2010 Link to this post

    Hello Gustav,

    Thank you for posting this. I am sure this will come in handy for a number of users. Your Telerik points have been updated.

    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Kiran
    Kiran avatar
    1 posts
    Member since:
    Jul 2010

    Posted 27 Jul 2010 Link to this post

Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.