Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, November 10, 2011 8:24 AM
Hi,
I'm new in C#. I want to add image or icons to bottons in my form. Can anyone suggest, how I can do it?
Thanks
Tuttu
All replies (4)
Thursday, November 10, 2011 8:40 AM ✅Answered | 1 vote
I did some fast research and found several interesting articles:
http://www.java2s.com/Code/CSharp/GUI-Windows-Form/AddimagetoButton.htm
http://www.codemiles.com/csharp-examples/put-image-on-button-in-c-t3276.html
http://www.vcskicks.com/image-button.php
Hope this helps
Dimitri C. - Please mark the replies as answers if they help! Thanks.
Thursday, November 10, 2011 8:46 AM ✅Answered | 2 votes
Hi,
You can do this by either setting the button BackgroundImage property from your properties window or you can do this programmatically like for this sample below:
button1.BackgroundImage = Image.FromFile(@"C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg");
Hope it helps
Thursday, November 10, 2011 1:48 PM ✅Answered | 5 votes
Hi,
I'm new in C#. I want to add image or icons to bottons in my form. Can anyone suggest, how I can do it?
Thanks
Tuttu
u can also add the image(s) to 'Resources' of ur project
and then set the background image source from there
this way the image stays in ur project and can move with ur project
this.button1.BackgroundImage = NameSpace1.Properties.Resources.UntitledImage2;
Don't miss to 'Vote As Helpful' or 'Mark As Answer' a deserving post.
Saturday, August 18, 2018 11:08 AM
Very useful, but NameSpace1 should not be mention