Printing colour or greyscale charts with a zoom function

Thread is closed for posting
3 posts, 0 answers
  1. 180D3990-92A3-4B41-9B12-DC88672DD33C
    180D3990-92A3-4B41-9B12-DC88672DD33C avatar
    5 posts
    Member since:
    Jul 2009

    Posted 04 May 2010 Link to this post

    Requirements

    RadControls version

    2009 Q3

    .NET version

    3.5

    Visual Studio version

    2008 SP1

    programming language

    C#


    PROJECT DESCRIPTION
    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)   
            {  
                try  
                {  
                    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);  
                                break;  
                            }  
                        case DialogResult.No:  
                            {  
                                ChartOperations.ApplyChartSkin(zoom, types.ChartSkins.GreyScale);  
                                zoom.Printing.PrintChart(prtSettings, pgSettings, ChartPrintOptions.ShowPrinterSelectDialog);  
                                break;  
                            }  
                    }  
                }  
                catch (Exception ex)  
                {  
                    throw new Exception("(PrintChart)" + ex.Message);  
                } 
  2. B9BDD87E-F5B3-4128-820F-47FFF6742BCD
    B9BDD87E-F5B3-4128-820F-47FFF6742BCD avatar
    2926 posts
    Member since:
    Aug 2017

    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.

    Sincerely,
    Ves
    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. 3E5DE5F4-5C41-44E5-A393-6186D1381816
    3E5DE5F4-5C41-44E5-A393-6186D1381816 avatar
    1 posts
    Member since:
    Jul 2010

    Posted 27 Jul 2010 Link to this post

    k
Back to Top

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