buat form transparan

‘ini adalah contoh dari form yang transparan yang didalamnya ada sebuah
‘tulisan,sehingga hanya kelihatan tulisannya saja…

imports system.drawing.drawing2d

Dim pindah As New Point

Private Sub Form1_load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.load
‘untuk membuat sebuah form yang transparan sangatlah mudah
‘yaitu dengan cara menyamakan warna form dengan warna transparancykey form
‘yang juga dapat diatur di properties form,selanjutnya form akan transparan deh…

Me.BackColor = System.Drawing.Color.Black
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.TransparencyKey = System.Drawing.Color.Black
End Sub

Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim fnt As New Font(“COMIC SANS MS”, 80, FontStyle.Bold, GraphicsUnit.Pixel)
Dim g As Graphics = e.Graphics
g.DrawString(txt, fnt, New SolidBrush(Color.blue), 100, 100)
End Sub

Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
pindah = New Point(-e.Y, -e.Y)
End Sub

Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
Dim b As Point = Control.MousePosition
b.Offset(pindah.X, pindah.Y)
Location = b
End If
End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: