开发者

How to extract image from embedded resource programmatically in VB .NET

开发者 https://www.devze.com 2023-01-08 22:19 出处:网络
I have a small vb.net app that have a few images in an embedded resource. Is there a way I could extract one of those images to a folder from the same exe that contains the resource?, like clicking a

I have a small vb.net app that have a few images in an embedded resource.

Is there a way I could extract one of those images to a folder from the same exe that contains the resource?, like clicking a button, selecting a folder to save 开发者_如何学Cit and extracting the image there.


Resource images can just be saved from the exe. Use a "SaveFileDialog" control to get the filename.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    SaveFileDialog1.ShowDialog()
End Sub

Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk
    My.Resources.Image2.Save(SaveFileDialog1.FileName, Drawing.Imaging.ImageFormat.Gif)
End Sub
0

精彩评论

暂无评论...
验证码 换一张
取 消