4 Replies - 3056 Views - Last Post: 05 August 2011 - 01:58 PM Rate Topic: -----

#1 Kirin   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 27-July 11

Is it possible to Resize a Form using Printform?

Posted 05 August 2011 - 12:35 PM

Hello,

I have been working with a windows form to create an ID card for users on a website.
I found that the Visual Basic Powerpack Component PrintForm can print my form with very little coding. The only problem is that I want to make my windows form the size of an ID card. Right now the form is about twice the size it needs to be.

I have tried resizing the whole form, but it just resizes the form, and not all the text and pictures inside.

Is there a way to resize the form and everything inside either before the form is printed, or during printing using printform?

If not, is there another way to print the entire form and resize it?

This is the code used to print with printform:

printForm1.PrintAction = PrintAction.PrintToPreview;
printForm1.Print();



Is This A Good Question/Topic? 0
  • +

Replies To: Is it possible to Resize a Form using Printform?

#2 tlhIn`toq   User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6537
  • View blog
  • Posts: 14,450
  • Joined: 02-June 10

Re: Is it possible to Resize a Form using Printform?

Posted 05 August 2011 - 01:20 PM

First: The Visual basic powerpack stuff sucks. Just my personal opinion. If I were you I'd use the normal printing methods for C#

Second: Printing to match a physical size requires you to
  • Get the DPI printing resolution of the printer. Both horizontal and vertical as some printers are different.
  • Calculate the number of pixels the output needs to be to match the resolution. For example if your printer is 150dpi and you want a 2 inch wide print then your output would be 150dpi * 2inches = 300px wide
  • Scale your output document to match your calculated needs.
  • Print.

Was This Post Helpful? 1
  • +
  • -

#3 Kirin   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 27-July 11

Re: Is it possible to Resize a Form using Printform?

Posted 05 August 2011 - 01:27 PM

View PosttlhIn`toq, on 05 August 2011 - 01:20 PM, said:

First: The Visual basic powerpack stuff sucks. Just my personal opinion. If I were you I'd use the normal printing methods for C#

Second: Printing to match a physical size requires you to
  • Get the DPI printing resolution of the printer. Both horizontal and vertical as some printers are different.
  • Calculate the number of pixels the output needs to be to match the resolution. For example if your printer is 150dpi and you want a 2 inch wide print then your output would be 150dpi * 2inches = 300px wide
  • Scale your output document to match your calculated needs.
  • Print.


Thank you. The normal printing methods for C# use the PrintDialog and PrintDialog tools, right?
Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq   User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6537
  • View blog
  • Posts: 14,450
  • Joined: 02-June 10

Re: Is it possible to Resize a Form using Printform?

Posted 05 August 2011 - 01:35 PM

Right.

If you are making an ID card, then personally I would probably make a bitmap to match the output size of the card - then paint on it the text and photograph and so on. It all happens in memory via code, not by laying it out in designer and saying 'print'. If it were that easy what would they have to pay programmers for?
Was This Post Helpful? 0
  • +
  • -

#5 Kirin   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 27-July 11

Re: Is it possible to Resize a Form using Printform?

Posted 05 August 2011 - 01:58 PM

View PosttlhIn`toq, on 05 August 2011 - 01:35 PM, said:

Right.

If you are making an ID card, then personally I would probably make a bitmap to match the output size of the card - then paint on it the text and photograph and so on. It all happens in memory via code, not by laying it out in designer and saying 'print'. If it were that easy what would they have to pay programmers for?



I agree, but I'm only an intern. :D
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1