Excepteur sint occa- ecat cupidatat

Excepteur sint occaecat cupid- atat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur

Excepteur sint occaecat cupid- atat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Suspendisse eget ante vitae ligula posuere

Excepteur sint occaecat cupid- atat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Quisque malesuada libero sed odio

Excepteur sint occaecat cupid- atat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Maecenas in enim vene- natis libero

Excepteur sint occaecat cupid- atat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Phasellus feugiat conse- ctetur sapien

Excepteur sint occaecat cupid- atat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Latest Articles

Fungsi ShellExecute


Fungsi ShellExecute merupakan salah satu fungsi API yang memiliki kegunaan yang beragam, mulai dari menjalankan file sampai dengan membuka alamat website.

Di bagian '(Declarations)' dari Form ketikkan :
[ VB 6.0 ]
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
[ VB .NET ]
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Integer, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer



Berikut macam-macam penggunaanya : (khusus untuk VB .NET, gantikan kode yang berwarna merah dengan kode "Me.Handle.ToInt32")

1). Membuka folder atau file.
ShellExecute Me.hwnd, "", "ALAMAT LOKASI FOLDER / FILE", "", "", vbNormalFocus

2). Menemukan folder / file dalam Windows Explorer.
ShellExecute Me.hwnd, "", "explorer.exe", "/select, ALAMAT LOKASI FOLDER / FILE", "", vbMaximizedFocus

3). Mencetak file.
ShellExecute Me.hwnd, "Print", "ALAMAT LOKASI FILE", "", "", vbNormalFocus

4). Membuka jendela pencarian / search berdasarkan folder.
ShellExecute Me.hwnd, "Find", "ALAMAT LOKASI FOLDER", "", "", vbNormalFocus

5). Membuka alamat website.
ShellExecute Me.hwnd, "", "ALAMAT WEBSITE", "", "", vbMaximizedFocus

6). Membuka aplikasi e-mail.
ShellExecute Me.hwnd, "", "mailto:ALAMAT E-MAIL", "", "", vbMaximizedFocus

Label Blink


Buat Form baru dengan sebuah Label dan sebuah Timer (Enabled=True; Interval=100).

Di bagian kontrol Timer-nya ketikkan :
Label1.Visible = Not Label1.Visible

Atau anda bisa ketikkan :
[ VB 6.0 ]
Randomize
Label1.ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
[ VB .NET ]
Randomize()
Label1.ForeColor = ColorTranslator.FromOle(RGB(Rnd() * 255, Rnd() * 255, Rnd() * 255))

Form Berwarna Gradien


Kode berikut ini akan mengubah latar Form menjadi kombinasi warna secara gradien.

[ VB 6.0 ]
Buat sebuah Module baru dan ketikkan :
Enum GradMode
gmHorizontal = 0
gmVertical = 1
End Enum

Public Function GradientForm(ByVal Frm As Form, ByVal StartColor As Long, ByVal Endcolor As Long, ByVal Mode As GradMode)
Dim Rs As Integer, Gs As Integer, Bs As Integer
Dim Re As Integer, Ge As Integer, Be As Integer
Dim Rk As Single, Gk As Single, Bk As Single
Dim R As Integer, G As Integer, B As Integer
Dim i As Integer, j As Single

On Error Resume Next
Frm.AutoRedraw = True
Frm.ScaleMode = vbPixels

Rs = StartColor And (Not &HFFFFFF00)
Gs = (StartColor And (Not &HFFFF00FF)) \ &H100&
Bs = (StartColor And (Not &HFF00FFFF)) \ &HFFFF&
Re = Endcolor And (Not &HFFFFFF00)
Ge = (Endcolor And (Not &HFFFF00FF)) \ &H100&
Be = (Endcolor And (Not &HFF00FFFF)) \ &HFFFF&

j = IIf(Mode = gmHorizontal, Frm.ScaleWidth, Frm.ScaleHeight)
Rk = (Rs - Re) / j: Gk = (Gs - Ge) / j: Bk = (Bs - Be) / j

For i = 0 To j
R = Rs - i * Rk: G = Gs - i * Gk: B = Bs - i * Bk
If Mode = gmHorizontal Then
Frm.Line (i, 0)-(i - 1, Frm.ScaleHeight), RGB(R, G, B), B
Else
Frm.Line (0, i)-(Frm.ScaleWidth, i - 1), RGB(R, G, B), B
End If
Next
End Function

Untuk menggunakannya ketikkan kode berikut di bagian 'Form_Resize' dari Form.
GradientForm Me, vbRed, vbBlue, 0



[ VB .NET ]
Buat sebuah Module baru dan ketikkan :
Public Sub GradientForm(ByVal Frm As Form, ByVal StartColor As Color, ByVal EndColor As Color, ByVal Mode As System.Drawing.Drawing2D.LinearGradientMode)
Dim a As New System.Drawing.Drawing2D.LinearGradientBrush(New RectangleF(0, 0, Frm.Width, Frm.Height), StartColor, EndColor, Mode)
Dim g As Graphics = Frm.CreateGraphics
g.FillRectangle(a, New RectangleF(0, 0, Frm.Width, Frm.Height))
g.Dispose()
End Sub

Untuk menggunakannya tambahkan kode berikut di Form :
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
GradientForm(Me, Color.Red, Color.Blue, 0)
End Sub

Dan di bagian 'Form_Resize'-nya ketikkan :
GradientForm(Me, Color.Red, Color.Blue, 0)

Form Bentuk Oval


Tidak selamanya Form harus berbentuk kotak, dengan sedikit penambahan kode, bentuk Form dapat diubah menjadi bentuk shape.

[ 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)




Untuk menggerakkan Form tersebut, caranya ada disini.

Form Login


Form Login biasanya dibuat untuk memberikan keterbatasan akses terhadap aplikasi, sehingga keamanan data yang diakses aplikasi terjaga dengan baik.
Download source code-nya disini

Mengubah Teks ke Suara


Kode berikut ini akan menunjukkan bagaimana suatu teks diubah menjadi suara.
Dim s
Set s = CreateObject("sapi.spvoice")
s.Speak Text1.Text

Menggerakkan Form Tanpa Border

Berikut cara untuk menggerakkan Form yang sengaja tanpa / tidak diberi border. [ VB 6.0 ] Di bagian 'Form_MouseMove' ketikkan :
If Me.WindowState <> 0 Then Exit Sub

Static l As Integer, t As Integer
If Button = 1 Then
Me.Left = (Me.Left + X) - l
Me.Top = (Me.Top + Y) - t
Else
l = X
t = Y
End If


[ VB .NET ]
Di bagian 'Form1_MouseMove' ketikkan :
If Me.WindowState <> FormWindowState.Normal Then Exit Sub

Static p As Point
If e.Button = Windows.Forms.MouseButtons.Left Then
Me.Left = (Me.Left + e.X) - p.X
Me.Top = (Me.Top + e.Y) - p.Y
Else
p = e.Location
End If

Cool B themes Slider