Icon.ToBitmap() : Icon « System.Drawing « VB.Net by API






Icon.ToBitmap()

  

Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms

public class DrawIcons
   public Shared Sub Main
        Application.Run(New Form1)
   End Sub
End class


Public Class Form1
    Inherits System.Windows.Forms.Form

    Public Sub New()
        MyBase.New()

        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(344, 273)
    End Sub

    Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
        Dim curIcon As New Icon("1.ico")
        Dim bmp As Bitmap = curIcon.ToBitmap()
        Dim g As Graphics = e.Graphics
        g.Clear(Me.BackColor)
        g.DrawImage(bmp, 10, 10)
        g.Dispose()
    End Sub

End Class

   
    
  








Related examples in the same category

1.New Icon(String fileName)
2.Icon.Height
3.Icon.Size
4.Icon.Width