|
-
Jan 15th, 2009, 07:57 AM
#1
Thread Starter
Frenzied Member
[2008]Print Entire Form
I have a user who wants to print the form that is on the screen(the entire form not just the data) on the click of a button, is there a quick and easy way to capture it and print it. Kind of like a screen shot?
I suggested that they could just do alt/printscreen and capture the form that way and print it but they want it all to be done from a print button for them.
-
Jan 15th, 2009, 08:40 AM
#2
Re: [2008]Print Entire Form
-
Jan 15th, 2009, 11:57 AM
#3
Re: [2008]Print Entire Form
Hi,
You can try this:
vb Code:
PrintForm1.PrintAction = Printing.PrintAction.PrintToPrinter PrintForm1.Print(Me, ClientAreaOnly) Me.Refresh
Wkr,
sparrow1
-
Jan 15th, 2009, 12:56 PM
#4
Thread Starter
Frenzied Member
Re: [2008]Print Entire Form
I added the Print Component and just tried it on a sample form, I think I will have to tweak it some to make the form fit on one page though. I still have to do it in C# but that shouldn't take long. Will post back if I have any problems.
-
Jan 15th, 2009, 01:15 PM
#5
Re: [2008]Print Entire Form
Hi,
For C# I think it's this:
vb Code:
{ PrintForm1.PrintAction = Printing.PrintAction.PrintToPrinter; PrintForm1.Print(this, ClientAreaOnly); this.Refresh(); }
Hope it helps,
sparrow1
-
Jan 15th, 2009, 01:52 PM
#6
Thread Starter
Frenzied Member
Re: [2008]Print Entire Form
It doesn't like "ClientAreaOnly" or any type of parameters. To set a form to print in Landscape do I need to use another Print Dialog, and combine the properties?
It also doesn't like Full Window to get the whole form.
-
Jan 15th, 2009, 02:16 PM
#7
Re: [2008]Print Entire Form
Hi,
Did you downloaded and installed the print component like Merion suggested.
Then it should work.
Wkr,
sparrow1
-
Jan 15th, 2009, 02:23 PM
#8
Thread Starter
Frenzied Member
Re: [2008]Print Entire Form
Oh yes I did, If I just do this;
Code:
private void btnPrint_Click(object sender, EventArgs e)
{
printForm1.PrintAction = PrintAction.PrintToPreview;
printForm1.Print();
this.Refresh();
}
It prints the form with no problem, but when I try to add any parameters it doesn't like them. But I do need to Print the form in a landscape style. I dragged the pageSetupDialog onto the form and played with the settings, I asssume I need to use mutiple dialogs to get the results I need?
-
Jan 15th, 2009, 03:08 PM
#9
Re: [2008]Print Entire Form
Hi,
After a search I found that you can't use dialogs.
But however you can find some proper information in the next link:
http://www.4d.com/docs/CMU/CMU00005.HTM
Hope it helps,
sparrow1
-
Jan 15th, 2009, 03:25 PM
#10
Re: [2008]Print Entire Form
-
Jan 15th, 2009, 03:26 PM
#11
Thread Starter
Frenzied Member
Re: [2008]Print Entire Form
Thanks I will have a look at it and see what I can put together.
-
Jan 15th, 2009, 09:09 PM
#12
Re: [2008]Print Entire Form
If you just follow Intellisense it tells you what to use. If you haven't added a 'using' directive to import the relevant namespace then Intellisense will display the fully qualified name of the enumeration and then you get to choose the value you want:
csharp Code:
this.printForm1.Print(this, Microsoft.VisualBasic.PowerPacks.Printing.PrintForm.PrintOption.ClientAreaOnly);
-
Jan 16th, 2009, 06:19 AM
#13
Thread Starter
Frenzied Member
Re: [2008]Print Entire Form
I did add this as a using statement at the top of the form
using Microsoft.VisualBasic.PowerPacks.Printing;
-
Jan 16th, 2009, 08:34 AM
#14
Re: [2008]Print Entire Form
Then Intellisense will help you to produce this:
csharp Code:
this.printForm1.Print(this, PrintForm.PrintOption.ClientAreaOnly);
-
Mar 11th, 2010, 11:50 PM
#15
New Member
Re: [2008]Print Entire Form
Ok I have the same problem except for me it will only print the top of the form and that is it. My code is the following if anyone can help?
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Focus()
Me.Show()
Me.PrintForm1.Print(Me, Microsoft.VisualBasic.PowerPacks.Printing.PrintForm.PrintOption.ClientAreaOnly)
PrintForm1.PrintAction = Printing.PrintAction.PrintToPrinter
PrintForm1.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.ClientAreaOnly)
Me.Refresh()
End Sub
End Class
All this does is print the top edge of my form. please help as this is my last problem with my program
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|