Re: [2008]Print Entire Form
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
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.
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
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.
Re: [2008]Print Entire Form
Hi,
Did you downloaded and installed the print component like Merion suggested.
Then it should work.
Wkr,
sparrow1
Re: [2008]Print Entire Form
Oh yes I did, :p 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?
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
Re: [2008]Print Entire Form
Re: [2008]Print Entire Form
Thanks I will have a look at it and see what I can put together.
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);
Re: [2008]Print Entire Form
I did add this as a using statement at the top of the form
using Microsoft.VisualBasic.PowerPacks.Printing;
Re: [2008]Print Entire Form
Then Intellisense will help you to produce this:
csharp Code:
this.printForm1.Print(this, PrintForm.PrintOption.ClientAreaOnly);
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