Setting Margins

A

active

If margins are measured from the paper edge
then I need to know the distance from the paper edge to the printable area
edge
so that I can be sure the user does not set the margin less than that.

If margins are measured from the printable edge
then I need to know the distance from the paper edge to the printable area
edge
so that when the user specifies the margin from the paper edge
I can calculate the margin from the printable area edge.

Anyone know where margins are measured from?

Also, how can I get the distance from the paper edge to the printable edge?


Thanks in advance,
Cal
 
A

active

That's what I did in VB6. Didn't what to use it if there was a managed way.

Thanks
Cal
 
H

Herfried K. Wagner [MVP]

* " active said:
That's what I did in VB6. Didn't what to use it if there was a managed way.

If I would know a managed way, I would have posted it.
 
J

Jay B. Harlow [MVP - Outlook]

Cal,
Charles Petzold's book "Programming Microsoft Windows with Microsoft Visual
Basic .NET - Core Reference" from MS Press has a discussion where you can
approximate the area, but to get a precise number you need to use the
GetDeviceCaps that Herfried showed.

VS.NET 2003 (.NET 1.1) includes a new PrintDocument.OriginAtMargins
property, which won't help with finding the number, but does help with
printing.

Hope this helps
Jay
 
A

active

I did this in VB6 but I use Printer.hdc. I can't figure how to get a
printer DC now. I not in any special method when I need it so I can't use a
method argument.


Thanks
Cal
 
R

Ron Allen

Cal,
You can use CreateMeasurementGraphics on a PrinterSettings object to get
a Graphics. Then call GetHDC() on the Graphics.
Ron Allen
 
R

Ron Allen

Cal,
Also note that if you set offsets for your PrintPage routine hardwired
to the printer then the PrintPreview with this will be offset up and to the
right by this amount.

Ron Allen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top