Mendisable Tombol Maximize di MDIForm

By hadiakrom

Jika anda menginginkan untuk menonaktifkan tombol maximize di MDIForm

Ketikan Source Code ini di MDIForm Editor anda:

‘=======================================

‘Buatlah 1 MDIForm

‘Copykan Script ini di MDIForm anda

Option Explicit

Private Declare Function GetWindowLong Lib “user32″ _
Alias “GetWindowLongA” (ByVal hWnd As Long, _
ByVal nIndex As Long) As Long

Private Declare Function SetWindowLong Lib “user32″ _
Alias “SetWindowLongA” (ByVal hWnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) _
As Long

Private Const GWL_STYLE = (-16)
Private Const WS_MINIMIZEBOX = &H20000
Private Const WS_MAXIMIZEBOX = &H10000

Public Sub NoMaxBox(f As MDIForm)
Dim H As Long
H = GetWindowLong(f.hWnd, GWL_STYLE)
H = H And Not (WS_MAXIMIZEBOX)
H = SetWindowLong(f.hWnd, GWL_STYLE, H)
End Sub

Public Sub NoMinBox(f As MDIForm)
Dim H As Long
H = GetWindowLong(f.hWnd, GWL_STYLE)
H =Hl And Not (WS_MINIMIZEBOX)
H = SetWindowLong(f.hWnd, GWL_STYLE, H)
End Sub

Private Sub MDIForm_Load()
NoMaxBox Me

‘Hilangkan tanda kutip di bawah jika ingin

‘mendisable tombol minimize
‘NoMinBox Me
End Sub

Private Sub MDIForm_Resize()
‘Ganti 5000 di bawah dgn lebar form yg fix Anda
‘tentukan Ganti 4000 di bawah dgn tinggi form yg fix
‘Anda tentukan
If Me.Width <> 5000 Then Me.Width = 5000
If Me.Height <> 4000 Then Me.Height = 4000
End Sub

Tinggalkan Balasan