Image in Label

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.
 
P

Peter Duniho

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
 
A

Alberto

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

Jeff Johnson

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.
 
P

Peter Duniho

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
 
J

Jeff Johnson

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()....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top