Art Of Programming

musings by Dmytrii Nagirniak

Image.GetBounds Always Returns Value in Pixels

Ok. Looking at the method Image.GetBounds I see:
Return value:
The RectangleF that represents the bounds of the image, in the specified unit.
So far so good. But please notice the signature of the method:
public RectangleF GetBounds(ref GraphicsUnit pageUnit)

We need to pass the unit of measurement BY REFERENCE. I had no idea why.
It turns out this method ALWAYS RETURNS THE VALUE IN PIXELS. Additionally the unit parameter is always set to Pixel instead.
And there is no ANY information about it on the documentation at all. Great. I wasted 2 hours for this.
Again have to patch, fix, extend.

Comments

Dmytrii Nagirniak
You are welcome. Glad the post has helped you.
Anonymous
Very unfortunate. But I appreciate the light rant. You've saved me from wasting 2 hours trying to fix the exact same thing- which would have been the end of my sanity. I have been working on my project for 48+ hours. Thank you! :)

Comments