CFanatic

Go Back   CFanatic > Programming > C# Programming

Join CFanatic Forum Now

Print, Print Preview, and PageSetup Dialog for TabPage in TabControl topic posted under C# Programming which is a part of Programming category in CFanatic Forum
Reply
 
Thread Tools Display Modes
  #1  
Old 07-19-2010, 10:27 PM
Junior Member
 
Join Date: Jul 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
nlraley is on a distinguished road
| More
Print, Print Preview, and PageSetup Dialog for TabPage in TabControl

I have a tab control with 2 tab pages contained within it that are each a seperate windows form.

I am tyring to use the following dialogs indicated above to print the contents of the windows form shown in the tab page of the tab control; however, I can't quite seem to figure out how to get the contents of the tab page to display. I am just getting blank pages on my print preview.

Here is what I have so far... My main form has a tab control with 2 tab pages, each having their content defined as such:
MainForm fileManagementForm = new MainForm();
UserManagement userManagementForm = new UserManagement();

userManagementForm.TopLevel = false;
userManagementForm.Parent = tabControl1.TabPages[0];
userManagementForm.FormBorderStyle = FormBorderStyle.None;
userManagementForm.Dock = DockStyle.Fill;

userManagementForm.Show();

fileManagementForm.TopLevel = false;
fileManagementForm.Parent = tabControl1.TabPages[1];
fileManagementForm.FormBorderStyle = FormBorderStyle.None;
fileManagementForm.Dock = DockStyle.Fill;

fileManagementForm.Show();

Next I created a new printing document:
private System.Drawing.Printing.PrintDocument docToPrint = new System.Drawing.Printing.PrintDocument();

Next for the print preview I am doing something like:
printPreviewDialog1.Document = docToPrint;
printPreviewDialog1.Show();

But of course I am getting an empty print preview dialog. How can I tell it to draw the contents of the current tab for the print document?

Any ideas how to set the document for the dialog to the tab page of a tab control? Nothing that I have tried will work and using Me, or this b/c I am using at the momment, yields a blank page. So if anyone can offer a recommendation or point me in the right direction I'd apprecaite it.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
print a to z hkp819 C Programming 5 03-11-2010 10:05 AM
How to print bit-patterns of a given integer heavensgate15 C Programming 2 06-27-2008 01:24 PM
trouble with CFormView print preview?an answer. praxisist MFC Programming 0 06-13-2008 01:34 AM
Code showing How to print a dialog widow... 冯锦华 MFC Programming 1 05-29-2007 06:40 AM
C# print problem -- page orientation benfly08 C# Programming 1 01-19-2007 08:57 PM

 

Advertisement

CFanatic Search
Custom Search

Advertisement

All times are GMT -5. The time now is 01:58 AM.



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO ©2010, Crawlability, Inc.
Cfanatic.com is a premier member of the IDG TechNetwork. For advertising opportunities contact here
Get Paid for Working on Projects Matching Your Expertise at Go4Expert's Jobs Board