Question about Print Preview window

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
DCG
Newbie
Newbie
Posts: 11
Joined: Thu Aug 10, 2006 12:00 am

Question about Print Preview window

Post by DCG » Fri Aug 25, 2006 3:57 pm

I use the print preview window in my application to display a graph for printing by the following code:

Code: Select all

RectangleF rectfTemp = graphData.Printer.PrintDocument.DefaultPageSettings.PrintableArea;

graphData.Printer.BeginPrint();
graphData.Printer.Print(new Rectangle((int)rectfTemp.X, (int)rectfTemp.Y, (int)rectfTemp.Height, (int)rectfTemp.Width - 100));

graphData.Printer.Preview();
The problem is this: I view the print preview window; I click "Setup..." and change the paper size, and click "OK".

Now the print previewer shows the correct paper size, but the graph is the wrong size (in the control). For example, if I chose a larger paper size (8.5"x14" when before I had 8.5"X11") the graph will not fill the printable area of the page.

The graph will still print correctly though.

I need to use the Printer.Print(rectangle r) overload so I can include some images in the ChartPrint event.

I'm using C# .NET 2005 and TeeChart Pro Version 2.0.2306.26232.

DCG
Newbie
Newbie
Posts: 11
Joined: Thu Aug 10, 2006 12:00 am

Post by DCG » Fri Aug 25, 2006 4:01 pm

Also, is there any way to get a custom icon on the print preview window?

This isn't critical, but would add continuity to my application.

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Mon Aug 28, 2006 7:59 am

Hi.

As Watermark over chart ? Yes, several ways to do it. You can either paint the image directly on tChart.Chart.Graphics3D in tChart OnAfterDraw event. Alternatively you can also use Annotation tool (with bacground image) or ChartImage tool.
Marjan Slatinek,
http://www.steema.com

DCG
Newbie
Newbie
Posts: 11
Joined: Thu Aug 10, 2006 12:00 am

Post by DCG » Mon Aug 28, 2006 6:43 pm

No, I do not wish to print an image on the chart; I want to replace the icon in the upper left hand corner of the Print Preview window (the little picture next to the text "Print Preview" on the title bar).

DCG
Newbie
Newbie
Posts: 11
Joined: Thu Aug 10, 2006 12:00 am

Post by DCG » Wed Sep 06, 2006 6:00 pm

I am still having the problem with the print preview window that I described in my first post for this thread.

I was just wondering if there is any kind of resolution for this, so that I can still use the same .Print() overload and have the preview window correctly show that page.

Thanks in advance.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Sep 07, 2006 2:22 pm

Hi DCG;

A colleague has encapsulated some of TeeChart’s printing functionality into a class called MyPrinter, which I'll attach as MyPrinter.cs to an e-mail to your forums contact address. You can use this class in the following manner:

Code: Select all

                   private void button2_Click(object sender, System.EventArgs e)
                   {
                            tChart1.Width = 3090;
                            MyPrinter letsPrint = new MyPrinter();
                            //letsPrint.Print(tChart1.Chart, new Rectangle(200,200,200,200));
                            letsPrint.Print(tChart1.Chart, new Point(10,10));
                   }


As you can see from the code in this class, using the public void Print(Chart c, Rectangle r) overload, MyPrinter will print a chart to the specified rectangle, but will clip the rectangle to the size of the paper if the chart is too big. Using the public void Print(Chart c, Point r) overload, MyPrinter will print the top left corner of the chart to the specified point and will calculate the chart size based on the paper size.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

DCG
Newbie
Newbie
Posts: 11
Joined: Thu Aug 10, 2006 12:00 am

Post by DCG » Fri Sep 08, 2006 4:03 pm

Thanks for the help, Narcís!

However, the MyPrinter class that you sent me (apparently) does not have a Print Preview option, so I have decided to go another route with my project.

Post Reply