Kamis, 16 Mei 2013

MEMBUAT FOEM BULAT VB6

Source code berikut untuk membuat form berbentuk ellips/bulat pada Visual Basic dengan hanya
beberapa baris kode.

Buat 1 project dengan :

1 Form
1 Module

Copy source code berikut pada Module :

Public Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long,_
ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Public Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long,_
ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Sub Form_Load()
SetWindowRgn hWnd, CreateEllipticRgn(0, 0, 300, 200), True
End Sub

MEMBUAT FORM TRANSPARAN VB 6

Membuat Form Transparan VB 6 (Session 1)

Ada kala kita membutuhkan Form yang transfaran atau tembus pandang. Gimanakah cara
membikinnya, berikut tip-tip:

Buat form baru dan satu buah module,
ketik listing berikut pada form:

Private Sub Form_Initialize()
'Ketranfaranan From yakni 0 - 255
TranslucentForm Me, 100
End Sub

Tambahkan module, Ketik listing berikut pada module:
Option Explicit
Public Const GWL_EXSTYLE = (-20)
Public Const WS_EX_LAYERED = &H80000
Public Const LWA_ALPHA = &H2
Public Const EM_GETLINECOUNT = &HBA
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA"(ByVal hWnd As_
Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As_
Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long_
Public Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long,_
ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As
Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Function TranslucentForm(frm As Form, TranslucenceLevel As Byte) As Boolean
SetWindowLong frm.hWnd, GWL_EXSTYLE, WS_EX_LAYERED
SetLayeredWindowAttributes frm.hWnd, 0, TranslucenceLevel, LWA_ALPHA
TranslucentForm = Err.LastDllError = 0
End Function

CopyRyght@2012 | Facebook | Twitte | Bloger | Google