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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted Jun 9, 2015, 7:35 AM EDT
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;
Manoj BhoirRank #599 · 4K reputationPosted Jun 9, 2015, 8:42 AM EDT
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;
Ayeshmantha Hettiarachchi13 reputationPosted Jun 9, 2015, 10:22 PM EDT