Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Dim dlg As New OpenFileDialog
- With dlg
- .Title = "Open File"
- .FileName = ""
- .Filter = "All Files|*.*"
- End With
- If dlg.ShowDialog() = Windows.Forms.DialogResult.OK Then
- Dim nicon As Icon = Icon.ExtractAssociatedIcon(dlg.FileName)
- PictureBox1.BackgroundImage = nicon.ToBitmap
- PictureBox1.BackgroundImageLayout = ImageLayout.Zoom
- End If
- End Sub
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- Dim dlg As New SaveFileDialog
- With dlg
- .Title = "Save Icon"
- .FileName = ""
- .Filter = "PNG|*.png"
- End With
- If dlg.ShowDialog() = Windows.Forms.DialogResult.OK Then
- PictureBox1.BackgroundImage.Save(dlg.FileName, System.Drawing.Imaging.ImageFormat.Png)
- End If
- End Sub
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement