Bitmap.MakeTransparent : Bitmap « System.Drawing « VB.Net by API






Bitmap.MakeTransparent

  

Imports System.Windows.Forms
Imports System.Drawing
Imports System.Drawing.Drawing2D
public class MakeTransparentBitmap
   public Shared Sub Main
        Application.Run(New Form1)
   End Sub
End class

Public Class Form1
    Inherits System.Windows.Forms.Form

    Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
        Me.Close()
    End Sub

    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        Dim bm As Bitmap = new Bitmap("yourfile.jpg")

        bm.MakeTransparent(bm.GetPixel(1, 1))

        e.Graphics.DrawImage(bm, 0, 0)
    End Sub
End Class

   
    
  








Related examples in the same category

1.New Bitmap
2.New Bitmap(Int w, Int y)
3.New Bitmap(String fileName)
4.Bitmap.FromFile(String fileName)
5.Bitmap.GetPixel
6.Bitmap.GetPixel(Int x, Int y)
7.Bitmap.Height
8.Bitmap.Palette
9.Bitmap.PhysicalDimension
10.Bitmap.PixelFormat
11.Bitmap.Save(String fileName, ImageFormat if)
12.Bitmap.SetPixel(Int x, Int y, Color clr)
13.Bitmap.SetResolution(Single h, Single v)
14.Bitmap.VerticalResolution
15.Bitmap.Width