[英]Setting background image of button in C#
我想将图像设置为Windows窗体按钮的背景。
该图像将添加到项目的资源中。
我该怎么做呢?
只需设置Button的BackgroundImage属性即可。 一个例子:
button1.BackgroundImage = ((System.Drawing.Image)(Properties.Resources.Image));
在加载应用程序或进行设置时都可以使用它。
button.BackgroundImage = YourApplicationNamespace.Properties.Resources.yourImageHere;
在Visual Studio中,您可以执行以下操作:
BackgroundImage
项。 或者,您可以通过代码执行以下操作:
button1.BackgroundImage = ((System.Drawing.Image)(Properties.Resources.Image));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.