HighTechTalks DotNet Forums  

PictureBox zoom printing

Dotnet Framework (Drawing) microsoft.public.dotnet.framework.drawing


Discuss PictureBox zoom printing in the Dotnet Framework (Drawing) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Mauro D.
 
Posts: n/a

Default PictureBox zoom printing - 02-08-2007 , 09:59 AM






Hi guys,
i'm trying to print a picturebox image with the SizeMode property set to
Zoom.

With DrawImage I can't get the size of the image inside the picturebox
because i get all of the displayrectangle instead.

There is a fast method to do this?

Mauro

Reply With Quote
  #2  
Old   
Bob Powell [MVP]
 
Posts: n/a

Default Re: PictureBox zoom printing - 02-08-2007 , 01:50 PM






PictureBox is horrible isn't it? Unfortunately there's no way of doing
this outside of using reflection to obtain the internal fields of the
component. My big question is why though.

PictureBox only calculates a rectangle with a very simple algorithm. If
you were to do an intelligent calc and use a transform you could account
for printer resolutions and all. After all, the PictureBox doesn't
change the image in any way, it just blindly draws it into this
rectangle. During printing you still have to recalculate and cope with
the printer page sizes because, unless you use interop and PrintWindow
for example, the PB won't draw itself correctly anyway.


--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





Mauro D. wrote:
Quote:
Hi guys,
i'm trying to print a picturebox image with the SizeMode property set to
Zoom.

With DrawImage I can't get the size of the image inside the picturebox
because i get all of the displayrectangle instead.

There is a fast method to do this?

Mauro

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.