I want know How to use Image/Icon as button. I saw in a video that, they do it in 2013 MSVisalStd... bt in my (2010)there was know such a command to do that.. ?? If you can plz....give me a hel..
Than..!!
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Ayeshmantha HettiarachchiPosted Jun 10, 2015, 2:22 AM
Manoj BhoirPosted Jun 9, 2015, 12:42 PM
objButton.Image = Image.FromFile(@"C:\Images\ImageFile.jpg");
// Align the image and text on the button.
objButton.ImageAlign = ContentAlignment.MiddleRight;
objButton.TextAlign = ContentAlignment.MiddleLeft;
// Give the button a flat appearance.
objButton.FlatStyle = FlatStyle.Flat;
this.button1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
Pankaj Kumar ChoudharyPosted Jun 9, 2015, 11:35 AM
The Image property of a Button control is used to set a button background as an image. The Image property needs an Image object. The Image class has a static method called FromFile that takes an image file name with full path and creates an Image object.
You can also align image and text. The ImageAlign and TextAlign properties of Button are used for this purpose.
The following code snippet sets an image as a button background.
// Assign an image to the button.
dynamicButton.Image = Image.FromFile(@"C:\Images\Dock.jpg");
// Align the image and text on the button.
dynamicButton.ImageAlign = ContentAlignment.MiddleRight;
dynamicButton.TextAlign = ContentAlignment.MiddleLeft;
// Give the button a flat appearance.
dynamicButton.FlatStyle = FlatStyle.Flat;