Reputation: 35
I want to set an image as background of a button of Windows Forms.
The image is added to the project´s resources.
How do I do this?
Upvotes: 2
Views: 35239
Reputation: 454
You would use this when you load your application, or whenever you want to set it.
button.BackgroundImage = YourApplicationNamespace.Properties.Resources.yourImageHere;
Upvotes: 6
Reputation: 5119
In Visual Studio, you can do this:
BackgroundImage
item. Or, from code you can do this:
button1.BackgroundImage = ((System.Drawing.Image)(Properties.Resources.Image));
Upvotes: 2
Reputation: 2769
Simply set the BackgroundImage property of the Button. An example:
button1.BackgroundImage = ((System.Drawing.Image)(Properties.Resources.Image));
Upvotes: 3