We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get the last page on print?

Thread ID:





8541 Nov 11,2003 06:44 AM UTC Nov 20,2003 04:03 AM UTC WinForms 11
Tags: GridControl
Asked On November 11, 2003 06:44 AM UTC

I will write something on the last page when on print ,bu how I can get the last page? and how to get the largest page number? thanks!

Administrator [Syncfusion]
Replied On November 11, 2003 07:41 AM UTC

If you override OnPrintPage in GridPrintDocument, you can test ev.HasMorePages to see if you are on the last page printed. Currently, there is no simple way to know in advance how may pages will be printed. Here is a sample that prints headers and footers with page numbers using an OnPrintPage override.

Replied On November 11, 2003 11:42 PM UTC

thanks Clay Burch. but I will draw some line on the last page ,the sample you supply me can ont get the last page.is has any ways to get it ?

Administrator [Syncfusion]
Replied On November 12, 2003 05:49 AM UTC

In your override on OnPrintPage, if ev.HasMorePages is false, then you are on the last page, and you can do the last page drawing at that point.

Replied On November 13, 2003 02:39 AM UTC

thanks !

Replied On November 13, 2003 03:23 AM UTC

I'm sorry ! how can I get the grid height in the last page??I will draw a line on the last row's bottom border

Administrator [Syncfusion]
Replied On November 14, 2003 08:32 AM UTC

I do not know of a good way to do this in general (locating the position on the print page of the last row). But if what you want to do is to draw a line on the border of the bottom row, you can do that from within the grid using PrepareViewStyleInfo.
private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
	if(this.gridControl1.PrintingMode && e.RowIndex == this.gridControl1.RowCount)
		e.Style.Borders.Bottom = new GridBorder(GridBorderStyle.Solid, Color.Red, GridBorderWeight.Thick);

Replied On November 18, 2003 02:05 AM UTC

thanks. But this is not I want to do ,I use gridcontrol to do a report ,and I fill report footer to the grid(the last row) .when printview it allways display a frame border with black ,so I want to cover it with a white line. but I don't know how to get the height of the last row when printview.

Administrator [Syncfusion]
Replied On November 18, 2003 06:16 AM UTC

I could not find a way to get the bottom of the grid in the OnPrintPage override. But you can get it in the PrepareViewStyleInfo event, and somehow make it available in OnPrintPage. Attached is a little sample using a static Form member to provide the value.

Replied On November 18, 2003 10:19 PM UTC

I don't know how to get it in the PrepareViewStyInfo event when it has multipage.and which sample did you point?

Administrator [Syncfusion]
Replied On November 18, 2003 10:41 PM UTC

Click the little disk download icon above my last response to get the sample. It has the PrepareViewStyleInfo event code in it.

Replied On November 20, 2003 04:03 AM UTC

It work well. thanks again!


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon