Turn your Mobile Apps into m-commerce apps – Learn More!

You're Browsing As A Guest! Register Now...
Become a C# Expert!

Join 415,716 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 774 people online right now.Registration is fast and FREE... Join Now!



printPreviewDialog - HELP Print Preview a .rft file. Rate Topic: -----

#1 hannesbez  Icon User is offline

  • New D.I.C Head
  • Pip

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 27-April 08


Dream Kudos: 0

Share |

printPreviewDialog - HELP

Posted 27 April 2008 - 06:23 AM

I have a multi-page file name xxx.rtf and all I want to do is print preview it. I have looked at dozens of pages on google without any success. What I have in my code is

private void printPreviewToolStripMenuItem_Click(object sender, EventArgs e)
{
	 printDocument1.DocumentName = "xxx.rtf";   //My File;
	 printPreviewDialog1.Document = printDocument1;
	 printPreviewDialog1.ShowDialog();
}



All it does is to display a single blank page in the dialog. Can someone please, please, please tell me what needs to be done. I thought I had dialogs taped, the I came across this one :(
Hannes
Was This Post Helpful? 0
  • +
  • -


#2 Martyr2  Icon User is online

  • Programming Theoretician
  • Icon

Reputation: 1435
  • View blog
  • Posts: 8,316
  • Joined: 18-April 07


Dream Kudos: 0

Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

Re: printPreviewDialog - HELP

Posted 27 April 2008 - 08:19 AM

Well you are going to have to setup the PrintPage event for your PrintDocument object. When you launch the preview it fires this event which is in charge of opening the file, setting up the lines per page, and drawing lines on the page. The print preview window can be thought of as a canvas.

So select your printdocument object, go to events and add a PrintPage event for it. Then you can put in some default PrintPage code you can find all over the net. Then you will be all set.

:)
Was This Post Helpful? 0
  • +
  • -



Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users