Mega Code Archive

 
Categories / VB.Net by API / System Drawing
 

Image FromFile

Imports System.Drawing Imports System.Drawing.Drawing2D Imports System.Windows.Forms public class TransparentColor    public Shared Sub Main         Application.Run(New Form1)    End Sub End class public class Form1   Inherits System.Windows.Forms.Form   Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)         Dim g As Graphics = e.Graphics         Dim curImage As Image = Image.FromFile("yourfile.jpg")         g.DrawImage(curImage, 0, 0, curImage.Width, curImage.Height)         Dim opqPen As New Pen(Color.FromArgb(255, 0, 255, 0), 10)         Dim transPen As New Pen(Color.FromArgb(128, 0, 255, 0), 10)         Dim totTransPen As New Pen(Color.FromArgb(40, 0, 255, 0), 10)         g.DrawLine(opqPen, 10, 10, 200, 10)         g.DrawLine(transPen, 10, 30, 200, 30)         g.DrawLine(totTransPen, 10, 50, 200, 50)         Dim semiTransBrush As New SolidBrush(Color.FromArgb(60, 0, 255, 0))         g.FillRectangle(semiTransBrush, 20, 100, 200, 100)   End Sub   Public Sub New()         MyBase.New()     Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)     Me.ClientSize = New System.Drawing.Size(292, 273)     Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen   End Sub End Class