Skip Navigation LinksHome / Community & Support / Code Library / WinForms > Chart > Printing colour or greyscale charts with a zoom function

Not answered Printing colour or greyscale charts with a zoom function

Feed from this thread
  • Posted on May 4, 2010 (permalink)

    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);  
                } 

    Reply

  • Ves Ves admin's avatar

    Posted on May 6, 2010 (permalink)

    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.

    Reply

  • Kiran avatar

    Posted on Jul 27, 2010 (permalink)

    k

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Code Library / WinForms > Chart > Printing colour or greyscale charts with a zoom function