首页 > 解决方案 > 在 VB.NET 中将图标导出为位图图像

问题描述

我在使用以下代码示例时遇到了很多麻烦:

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.Icon.ToBitmap.Save("..\help.bmp", Imaging.ImageFormat.Bmp)
    End Sub
End Class

目的是将图标导出为位图文件。但是 - 它不会产生任何输出。有任何想法吗?

标签: vb.net

解决方案


您的代码完美运行,您需要指定完整的确切路径来保存图标。我已经在我的机器上试过这个并且它正在工作。

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Icon.ToBitmap.Save("C:\Users\<user_name>\Desktop\hello.bmp", Imaging.ImageFormat.Bmp)
End Sub

很棒的 bmp 图片


推荐阅读