Image in Label

  • Thread starter Thread starter Alberto
  • Start date Start date
A

Alberto

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.
 
Alberto said:
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
 
Could you tell me which method should I use to scale the bitmap? I can't
find it.
Thank you very much
 
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.
 
Jeff said:
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! :) )

Pete
 
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! :) )

Believe me, I have to FORCE myself to remember! I still want to knee-jerk
and say Graphics.DrawImage()....
 
Back
Top