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?
Simply set the BackgroundImage property of the Button. An example:
button1.BackgroundImage = ((System.Drawing.Image)(Properties.Resources.Image));
在加载应用程序或进行设置时都可以使用它。
button.BackgroundImage = YourApplicationNamespace.Properties.Resources.yourImageHere;
In Visual Studio, you can do this:
BackgroundImage
item. Or, from code you can do this:
button1.BackgroundImage = ((System.Drawing.Image)(Properties.Resources.Image));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.