Pada siang ini saya akan memberikan tutorial lagi .
[ VB 6.0 ]
Buat sebuah Form baru (properti BorderStyle=None), lalu di bagian '(Declarations)' dari Form ketikkan :
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Untuk membuat Form berbentuk shape rounded rectangle, di bagian 'Form_Load' ketikkan :
Dim l As Long
l = CreateRoundRectRgn(0, 0, Me.Width / Screen.TwipsPerPixelX, Me.Height / Screen.TwipsPerPixelY, 20, 20)
SetWindowRgn Me.hwnd, l, 0
Sedangkan untuk membuat Form berbentuk shape oval / lingkaran, di bagian 'Form_Load' ketikkan :
Dim l As Long
l = CreateEllipticRgn(0, 0, Me.Width / Screen.TwipsPerPixelX, Me.Height / Screen.TwipsPerPixelY)
SetWindowRgn Me.hwnd, l, 0
[ VB .NET ]
Buat sebuah Form baru (properti FormBorderStyle=None), lalu di bagian '(Declarations)' dari Form ketikkan :
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Integer, ByVal Y1 As Integer, ByVal X2 As Integer, ByVal Y2 As Integer, ByVal X3 As Integer, ByVal Y3 As Integer) As Integer
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Integer, ByVal Y1 As Integer, ByVal X2 As Integer, ByVal Y2 As Integer) As Integer
Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Integer, ByVal hRgn As Integer, ByVal bRedraw As Boolean) As Integer
Untuk membuat Form berbentuk shape rounded rectangle, di 'Form1_Load' ketikkan :
Dim i As Integer
i = CreateRoundRectRgn(0, 0, Me.Width, Me.Height, 20, 20)
SetWindowRgn(Me.Handle, i, 0)
Sedangkan untuk membuat Form berbentuk shape oval / lingkaran, di bagian 'Form1_Load' ketikkan :
Dim i As Integer
i = CreateEllipticRgn(0, 0, Me.Width, Me.Height)
SetWindowRgn(Me.Handle, i, 0)
Semoga dapat membantu . :)
No comments:
Post a Comment