Results 1 to 2 of 2

Thread: Printing to a set size?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    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#

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width