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.
Unfortunately, activation email could not send to your email. Please try again.

How to get the last page on print?

Thread ID:

Created:

Updated:

Platform:

Replies:

8541 Nov 11,2003 01:44 AM Nov 19,2003 11:03 PM Windows Forms 11
loading
Tags: GridControl
Kis
Asked On November 11, 2003 01:44 AM

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 02:41 AM

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.

Kis
Replied On November 11, 2003 06:42 PM

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 12:49 AM

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.

Kis
Replied On November 12, 2003 09:39 PM

thanks !

Kis
Replied On November 12, 2003 10:23 PM

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 03:32 AM

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

Kis
Replied On November 17, 2003 09:05 PM

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 01:16 AM

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.

Kis
Replied On November 18, 2003 05:19 PM

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 05:41 PM

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

Kis
Replied On November 19, 2003 11:03 PM

It work well. thanks again!

CONFIRMATION

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.

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.

;