|
-
Oct 15th, 2010, 01:51 PM
#1
Printing to a set size?
I'm trying to get my head around printing and graphics.
Ok, lets say I have a picturebox and I draw a square in the picturebox. I want the square to be one inch square when it is printed. How do I draw the square in such a way that when it is printed it will be one inch square?
In VB6 you could set the scale mode of the picturebox and the printer so this wasn't a problem. I haven't found anything like this in C#
-
Oct 15th, 2010, 10:32 PM
#2
Re: Printing to a set size?
I'm not 100% sure whether it will answer your question but you might want to visit the VB.NET CodeBank forum and check out Merrion's beginner's guide to printing. The code is in VB but the principles are all language independent. Windows Forms is all about screen pixels so your on-screen drawing will look different on monitors with different DPIs. As such, you'd have to do a bit of calculating with the printer's DPI when it comes time to print.
You may also want to look into using WPF instead of WinForms. WPF uses device-independent pixels, so making something look the same on different monitors is much easier. It also uses a completely different printing path, based on XPS. For more info on that, see the System.Printing namespace.
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
|