By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,847 Members | 2,354 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,847 IT Pros & Developers. It's quick & easy.

page margin setting

P: n/a
Hi, I am using framework 1.0 to implement a printing
method. The page margins I set won't show correctly on my
print out. The code is:
PageSettings pset=new PageSettings();
pset.Margins =new Margins(10,10,100,100);
printDoc.DefaultPageSettings=pset;

I have seen some explaination about
PrintDocument.OriginAtMargins property. But I am not
using the Framework 1.1. Is this the reason that the page
margins are not correct? Is there a way to implement this
in Framework 1.0?
Thanks.

Holly
Nov 15 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Holly,
If you are using Framework V1.0 you will have to PInvoke GetDeviceCaps
and retrieve the 'hard margins' of the printer and then compensate for those
when you draw to the printer (I normally just call Graphics.Translate by the
appropriate amounts). A quick a dirty check to see if you are drawing to
the printer vs. a PrintPreviewDialog is to check the VisibleClipBounds. If
this is smaller than the page size you are most likely drawing to the
printer. If you'd like I have some C# code that calls GetDeviceCaps and
returns the page margins. Note that on some printers, mainly inkjets, you
may have to scale the output to get it the same as output to a laser.
Also the margins you are specifying may be too small for the printer as
0.1 inches is outside the printable area on a lot of printers.

Ron Allen
"Holly" <ho*****@mindrenewingmedia.com> wrote in message
news:01****************************@phx.gbl...
Hi, I am using framework 1.0 to implement a printing
method. The page margins I set won't show correctly on my
print out. The code is:
PageSettings pset=new PageSettings();
pset.Margins =new Margins(10,10,100,100);
printDoc.DefaultPageSettings=pset;

I have seen some explaination about
PrintDocument.OriginAtMargins property. But I am not
using the Framework 1.1. Is this the reason that the page
margins are not correct? Is there a way to implement this
in Framework 1.0?
Thanks.

Holly

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.