Membuat bentuk form non-kotak
Tidak selamanya bentuk Form harus berbentuk kotak. Anda bisa mengubah bentuk Form dengan bentuk yang unik, sehingga tampil beda dari Form-form yang lain.
Carnya Anda cukup menuliskan pilihan kode dibawah ini di event Form1_Load :
Form berbentuk lingkaran
'menghilangkan border
Me.FormBorderStyle = 0
Dim p As New Drawing2D.GraphicsPath()
p.AddEllipse(0, 0, Me.Width, Me.Height)
Me.Region = New Region(p)
Form berbentuk kotak dengan sisi lengkung
'menghilangkan border
Me.FormBorderStyle = 0
Dim p As New Drawing2D.GraphicsPath()
Dim Pojok As Integer
Pojok = 50
p.AddArc(New Rectangle(0, 0, Pojok, Pojok), 180, 90)
p.AddLine(Pojok, 0, Me.Width - Pojok, 0)
p.AddArc(New Rectangle(Me.Width - Pojok, 0, Pojok, Pojok), -90, 90)
p.AddLine(Me.Width, Pojok, Me.Width, Me.Height - Pojok)
p.AddArc(New Rectangle(Me.Width - Pojok, Me.Height - Pojok, Pojok, Pojok), 0, 90)
p.AddLine(Me.Width - Pojok, Me.Height, Pojok, Me.Height)
p.AddArc(New Rectangle(0, Me.Height - Pojok, Pojok, Pojok), 90, 90)
Me.Region = New Region(p)
Form berbentuk daun
'menghilangkan border
Me.FormBorderStyle = 0
Dim p As New Drawing2D.GraphicsPath()
Dim Pojok As Integer
Pojok = 250
p.AddLine(0, 0, Me.Width - Pojok, 0)
p.AddArc(New Rectangle(Me.Width - Pojok, 0, Pojok, Pojok), -90, 90)
p.AddLine(Me.Width, Pojok, Me.Width, Me.Height)
p.AddLine(Me.Width - Pojok, Me.Height, Pojok, Me.Height)
p.AddArc(New Rectangle(0, Me.Height - Pojok, Pojok, Pojok), 90, 90)
Me.Region = New Region(p)
Form berbentuk segi delapan
'menghilangkan border
Me.FormBorderStyle = 0
Dim p As New Drawing2D.GraphicsPath()
Dim Pojok As Integer
Dim pf(7) As PointF
Pojok = 50
pf(0) = New PointF(0, Pojok)
pf(1) = New PointF(Pojok, 0)
pf(2) = New PointF(Me.Width - Pojok, 0)
pf(3) = New PointF(Me.Width, Pojok)
pf(4) = New PointF(Me.Width, Me.Height - Pojok)
pf(5) = New PointF(Me.Width - Pojok, Me.Height)
pf(6) = New PointF(Pojok, Me.Height)
pf(7) = New PointF(0, Me.Height - Pojok)
p.AddPolygon(pf)
Me.Region = New Region(p)

terima kasih banyak...artikelnya membantu banget
BalasHapus