Hunter Mitchell
Hunter Mitchell

Reputation: 7293

Trouble with PrintForm Control in C#

i have used this:

Margins margins = new Margins(5, 5, 5, 5); 
        printForm1.PrinterSettings.DefaultPageSettings.Margins = margins;
        printForm1.Print(); 

but the form printed was aligned to the left for some reason, so i edited it and used this code:

Margins margins = new Margins(10, 5, 10, 5); 
        printForm1.PrinterSettings.DefaultPageSettings.Margins = margins;
        printForm1.Print(); 

For some reason, this did nothing to move the form over or to center it on the paper. How do i fix this Poblem?

Upvotes: 0

Views: 708

Answers (1)

Semen Shekhovtsov
Semen Shekhovtsov

Reputation: 882

PrintForm class is a simple Microsoft.VisualBasic.PowerPacks feature for printing a form content, I don't think it will allow you to change Margin or other printing options. If you wanna customize printing you would better use BitBlt win32 function, like it is suggested here: http://msdn.microsoft.com/en-us/library/aa287529%28v=vs.71%29.aspx, or if you need to print some specific elements, not the whole form you can use code provided in the fallowing article http://www.c-sharpcorner.com/uploadfile/mgold/howtoprintingformcontrolsincsharpand.net11212005063649am/howtoprintingformcontrolsincsharpand.net.aspx

Upvotes: 1

Related Questions