Beranda > Java Tutorial, Sinaung > buat form transparan

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

Sumber: http://stikomksi2007azwar.wordpress.com/2007/09/29/buat-form-transparan/

  1. Belum ada komentar.
  1. No trackbacks yet.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: