Langkah 1 : Buat Project Baru
Langkah 2 : Tambahkan MDI Form, kemudian tambahkan picturebox dan caption diatasnya serta tombol sebagai ganti dari tombol Close. Gambarannya adalah seperti berikut
Langkah 3 : Tuliskan syntax berikut ini
Option Explicit
Private Sub cmdClose_Click()
End
End Sub
Private Sub MDIForm_Load()
HideCaption hWnd, False
End Sub
Langkah 4 : Tambahkan Module dengan syntax berikut ini
Private Enum WinType
GWL_STYLE = (-16)
SWP_FRAMECHANGED = &H20
SWP_NOMOVE = &H2
SWP_NOZORDER = &H4
SWP_NOSIZE = &H1
End Enum
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal wNewWord As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowPos Lib "user32" _
(ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, _
ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Function HideCaption(hWnd As Long, Optional ShowBorder As Boolean = True)
Dim lStyle As Long
lStyle = GetWindowLong(hWnd, GWL_STYLE)
If ShowBorder Then
lStyle = lStyle Or &HC00000
Else
lStyle = lStyle And Not &HC00000
End If
Call SetWindowLong(hWnd, GWL_STYLE, lStyle)
Call pRedraw(hWnd)
lStyle = GetWindowLong(hWnd, GWL_STYLE)
End Function
Private Sub pRedraw(hWnd As Long)
Const swpFlags As Long = _
SWP_FRAMECHANGED Or SWP_NOMOVE Or _
SWP_NOZORDER Or SWP_NOSIZE
Call SetWindowPos(hWnd, 0, 0, 0, 0, 0, swpFlags)
End Sub
Maka Hasilnya adalah
Tidak ada komentar:
Posting Komentar