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.