C# .NET - C# 3.0 - Resize image to best fit into button

Asked By Aldo Liaks on 30-May-08 03:01 AM

Hi guys,

I attached a jpg image to a button.

How do I make to fit (best fit) into te button?

Is there any SizeToFit property?

Thanks,

Aldo.

use BackgroundImageLayout Property.. - Vasanthakumar D replied to Aldo Liaks on 30-May-08 03:35 AM

Hi,

you can set the BackgroundImageLayout Property to stretch...

Stretch - Santhosh N replied to Aldo Liaks on 30-May-08 03:44 AM

You can set the BackgroundImageLayout property to Stretch,

But, you will lose the quality..The best option is to have an image of required size to be developed

Thanks - Aldo Liaks replied to Vasanthakumar D on 30-May-08 03:55 AM

end of post
Yeap - Aldo Liaks replied to Santhosh N on 30-May-08 03:55 AM
time limits... :-)
HI - Sagar P replied to Aldo Liaks on 30-May-08 04:32 AM

Hello Aldo,
see the thing is that, there is no such property which will give you image best fit for button. There is one BackgroundImageLayout property which can be set to 'Stretch' to fit that image to button. But the problem with this is the quality of image will be destroyed. So i think you have to make the image of the size same as that of button so that it can fit exactly for that button.

Best Luck!!!!!!!!!!!!!
Sujit.

Thanks man - Aldo Liaks replied to Sagar P on 30-May-08 04:42 AM
end of post
Instead of Resize image to best fit into button - Shailendrasinh Parmar replied to Aldo Liaks on 30-May-08 05:47 AM
Hi, you can set the BackgroundImageLayout property = "stretch" for this.

But you may loose the quality of a picture.
Thanks - Aldo Liaks replied to Shailendrasinh Parmar on 30-May-08 06:39 AM
end of post