更新按钮 VB.net 上的图像

发布于 2024-12-15 16:28:17 字数 71 浏览 3 评论 0原文

我正在尝试制作一个显示图像的按钮,这很简单,但是该图像是一个可编辑的图标,因此我希望每次启动表单时都更新按钮上的图像,该怎么办?

I’m trying to make a button that displays an image, that’s easy, but the image is an editable icon so I want the image on the button to be updated every time the form is started how can this be done?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不再让梦枯萎 2024-12-22 16:28:17

我假设您正在使用 WinForms 并将编辑后的图标保存到文件中。

看看这个 MSDN ButtonBase.Image 属性上的页面。

从上面的链接:

button1.Image = Image.FromFile("C:\Graphics\MyBitmap.bmp")

您可以将其放在“新子例程”中的“InitializeComponent 语句”之后。或在您的表单加载事件中。

I am making the assumption that you are using WinForms and saving your editied icon to a file.

Take a look at this MSDN page on ButtonBase.Image Property.

From above link:

button1.Image = Image.FromFile("C:\Graphics\MyBitmap.bmp")

You can put this in the New Subroutine after the InitializeComponent Statement. or in your Form Load event.

断舍离 2024-12-22 16:28:17

使用Graphics方法并处理Button的Paint事件。您可以在图像或按钮区域添加文本和原始绘图。

Use Graphics method and also handle the Paint event of Button. You can add text and primitive drawing on Image or Button region.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文