Main Page | Report this Page
.NET DotNet Forum Index  »  Visual C# Forum  »  Image in Label...
Page 1 of 1    

Image in Label...

Author Message
Alberto...
Posted: Tue Oct 27, 2009 5:08 pm
Guest
The Label control has a property called Image but I can't find a way to
adjust the image to the size of the Label as the SizeMode property of the
PictureBox control does when it has the value StretchImage.

Is it posible? thank you.
 
Peter Duniho...
Posted: Tue Oct 27, 2009 5:51 pm
Guest
Alberto wrote:
Quote:
The Label control has a property called Image but I can't find a way to
adjust the image to the size of the Label as the SizeMode property of
the PictureBox control does when it has the value StretchImage.

Is it posible? thank you.

AFAIK, nothing in the control supports that. But, you could easily
scale the bitmap yourself before assigning it to the Image property.

Pete
 
Peter Duniho...
Posted: Wed Oct 28, 2009 1:13 pm
Guest
Jeff Johnson wrote:
Quote:
"Alberto" <alberto at (no spam) nospam.es> wrote in message
news:eL6Pgp7VKHA.1792 at (no spam) TK2MSFTNGP04.phx.gbl...

Could you tell me which method should I use to scale the bitmap? I can't
find it.

Use the constructor overload of the Bitmap class that lets you provide an
existing bitmap (your original) and the size you want the new Bitmap to be.

In addition to what Jeff wrote, if you want higher-quality scaling, you
need to explicitly draw the original into a new bitmap after setting the
interpolation mode to a higher-quality setting. There are a number of
threads in this newsgroup already on the topic...just use Google Groups
to find them.

(And Jeff, nice job remembering about the constructor this time! Smile )

Pete
 
Jeff Johnson...
Posted: Wed Oct 28, 2009 3:34 pm
Guest
"Peter Duniho" <no.peted.spam at (no spam) no.nwlink.spam.com> wrote in message
news:O3lTMLAWKHA.4780 at (no spam) TK2MSFTNGP05.phx.gbl...

Quote:
Could you tell me which method should I use to scale the bitmap? I can't
find it.

Use the constructor overload of the Bitmap class that lets you provide an
existing bitmap (your original) and the size you want the new Bitmap to
be.

In addition to what Jeff wrote, if you want higher-quality scaling, you
need to explicitly draw the original into a new bitmap after setting the
interpolation mode to a higher-quality setting. There are a number of
threads in this newsgroup already on the topic...just use Google Groups to
find them.

(And Jeff, nice job remembering about the constructor this time! Smile )

Believe me, I have to FORCE myself to remember! I still want to knee-jerk
and say Graphics.DrawImage()....
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Tue Nov 24, 2009 4:31 pm