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 |