超高分!!VB的 MDI 窗体怎样 禁用还原按钮!!!!!!
要求:1.还原按钮变成灰色.2.系统菜单也不能出现还原命令!只要解决总是,本人从不吝啬,立即给分!!!在最大化后,最大化按钮失效也可以各位高手,窗口启动后就最大化,然后,...
要求:
1.还原按钮变成灰色.
2.系统菜单也不能出现还原命令!
只要解决总是,本人从不吝啬,立即给分!!!
在最大化后,最大化按钮失效也可以
各位高手,窗口启动后就最大化,然后,按钮失效! 展开
1.还原按钮变成灰色.
2.系统菜单也不能出现还原命令!
只要解决总是,本人从不吝啬,立即给分!!!
在最大化后,最大化按钮失效也可以
各位高手,窗口启动后就最大化,然后,按钮失效! 展开
展开全部
' 去除系统菜单里还原项用常量
Const SC_MAXIMIZE = &HF030
Const SC_MINIMIZE = &HF020
Const SC_MOVE = &HF010
Const SC_RESTORE = &HF120
Const SC_SIZE = &HF000
Const SC_CLOSE = &HF060
Const MF_BYCOMMAND = 0
' 去掉窗口的还原按钮常量
Const WS_MAXIMIZE = &H1000000
Const WS_MAXIMIZEBOX = &H10000
Const WS_MINIMIZE = &H20000000
Const WS_MINIMIZEBOX = &H20000
Const GWL_STYLE = -16
' 得到系统菜单句柄
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
' 删除系统菜单项
Private Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags 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 SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
' 窗体加载
Private Sub MDIForm_Load()
' 去除菜单项里的还原
Dim hMenu As Long
hMenu = GetSystemMenu(Me.hwnd, 0)
Call DeleteMenu(hMenu, SC_RESTORE, MF_BYCOMMAND)
' 灰显还原按钮(可根据时机进行运行,如在最大化后)
Dim WindowStyle As Long
WindowStyle = GetWindowLong(Me.hwnd, GWL_STYLE)
WindowStyle = WindowStyle And Not (WS_MAXIMIZEBOX)
Call SetWindowLong(Me.hwnd, GWL_STYLE, WindowStyle)
End Sub
----------------------------------------------------------
加上一句话就可以保证启动最大化:
Me.WindowState = 2
把这句话加到Form的Load事件中就行了.
Const SC_MAXIMIZE = &HF030
Const SC_MINIMIZE = &HF020
Const SC_MOVE = &HF010
Const SC_RESTORE = &HF120
Const SC_SIZE = &HF000
Const SC_CLOSE = &HF060
Const MF_BYCOMMAND = 0
' 去掉窗口的还原按钮常量
Const WS_MAXIMIZE = &H1000000
Const WS_MAXIMIZEBOX = &H10000
Const WS_MINIMIZE = &H20000000
Const WS_MINIMIZEBOX = &H20000
Const GWL_STYLE = -16
' 得到系统菜单句柄
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
' 删除系统菜单项
Private Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags 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 SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
' 窗体加载
Private Sub MDIForm_Load()
' 去除菜单项里的还原
Dim hMenu As Long
hMenu = GetSystemMenu(Me.hwnd, 0)
Call DeleteMenu(hMenu, SC_RESTORE, MF_BYCOMMAND)
' 灰显还原按钮(可根据时机进行运行,如在最大化后)
Dim WindowStyle As Long
WindowStyle = GetWindowLong(Me.hwnd, GWL_STYLE)
WindowStyle = WindowStyle And Not (WS_MAXIMIZEBOX)
Call SetWindowLong(Me.hwnd, GWL_STYLE, WindowStyle)
End Sub
----------------------------------------------------------
加上一句话就可以保证启动最大化:
Me.WindowState = 2
把这句话加到Form的Load事件中就行了.
展开全部
Private Sub Form_Resize()
'如果最大化
Static bs As Integer
If Me.WindowState = 2 Then
bs = 1
End If
'如果已最大化 并且将要还原
If bs = 1 And Me.WindowState = 0 Then
Me.WindowState = 2
End If
End Sub
'如果最大化
Static bs As Integer
If Me.WindowState = 2 Then
bs = 1
End If
'如果已最大化 并且将要还原
If bs = 1 And Me.WindowState = 0 Then
Me.WindowState = 2
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
把代码放到MDI窗体中即可,这个可以使窗体的最大化按钮失效,菜单没有最大化,且窗体不可以调整大小
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 Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Const MF_REMOVE = &H1000&
Private Const SC_MAXIMIZE = &HF030&
Private Const GWL_STYLE = (-16)
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_SIZEBOX = &H40000
Private Sub MDIForm_Load()
Dim hMenu As Long, lWnd As Long
lWnd = GetWindowLong(Me.hwnd, GWL_STYLE)
lWnd = lWnd And Not (WS_MAXIMIZEBOX)
lWnd = lWnd And Not (WS_SIZEBOX)
lWnd = SetWindowLong(Me.hwnd, GWL_STYLE, lWnd)
hMenu = GetSystemMenu(Me.hwnd, 0)
RemoveMenu hMenu, SC_MAXIMIZE, MF_REMOVE
End Sub
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 Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Const MF_REMOVE = &H1000&
Private Const SC_MAXIMIZE = &HF030&
Private Const GWL_STYLE = (-16)
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_SIZEBOX = &H40000
Private Sub MDIForm_Load()
Dim hMenu As Long, lWnd As Long
lWnd = GetWindowLong(Me.hwnd, GWL_STYLE)
lWnd = lWnd And Not (WS_MAXIMIZEBOX)
lWnd = lWnd And Not (WS_SIZEBOX)
lWnd = SetWindowLong(Me.hwnd, GWL_STYLE, lWnd)
hMenu = GetSystemMenu(Me.hwnd, 0)
RemoveMenu hMenu, SC_MAXIMIZE, MF_REMOVE
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Declare Function SetWindowLong Lib "USER32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "USER32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Sub DisableX()
Dim hMenu, nCount, LO As Long
hMenu = GetSystemMenu(Me.hwnd, 0)
nCount = GetMenuItemCount(hMenu)
LO = RemoveMenu(hMenu, nCount - 3, MF_REMOVE Or MF_BYPOSITION)
LO = RemoveMenu(hMenu, nCount - 4, MF_REMOVE Or MF_BYPOSITION)
End Sub
Private Sub MDIForm_Load()
Dim lWnd As Long
DisableX
lWnd = GetWindowLong(Me.hwnd, GWL_STYLE)
'lWnd = lWnd And Not (WS_MINIMIZEBOX)
lWnd = lWnd And Not (WS_MAXIMIZEBOX)
lWnd = SetWindowLong(Me.hwnd, GWL_STYLE, lWnd)
End Sub
Private Declare Function GetWindowLong Lib "USER32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Sub DisableX()
Dim hMenu, nCount, LO As Long
hMenu = GetSystemMenu(Me.hwnd, 0)
nCount = GetMenuItemCount(hMenu)
LO = RemoveMenu(hMenu, nCount - 3, MF_REMOVE Or MF_BYPOSITION)
LO = RemoveMenu(hMenu, nCount - 4, MF_REMOVE Or MF_BYPOSITION)
End Sub
Private Sub MDIForm_Load()
Dim lWnd As Long
DisableX
lWnd = GetWindowLong(Me.hwnd, GWL_STYLE)
'lWnd = lWnd And Not (WS_MINIMIZEBOX)
lWnd = lWnd And Not (WS_MAXIMIZEBOX)
lWnd = SetWindowLong(Me.hwnd, GWL_STYLE, lWnd)
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Option Explicit
Const SC_MAXIMIZE = &HF030
Const SC_MINIMIZE = &HF020
Const SC_MOVE = &HF010
Const SC_RESTORE = &HF120
Const SC_SIZE = &HF000
Const SC_CLOSE = &HF060
Const MF_BYCOMMAND = 0
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Sub Form_Load()
Dim hMenu As Long
hMenu = GetSystemMenu(Me.hwnd, 0)
Call DeleteMenu(hMenu, SC_RESTORE, MF_BYCOMMAND)
End Sub
Const SC_MAXIMIZE = &HF030
Const SC_MINIMIZE = &HF020
Const SC_MOVE = &HF010
Const SC_RESTORE = &HF120
Const SC_SIZE = &HF000
Const SC_CLOSE = &HF060
Const MF_BYCOMMAND = 0
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Sub Form_Load()
Dim hMenu As Long
hMenu = GetSystemMenu(Me.hwnd, 0)
Call DeleteMenu(hMenu, SC_RESTORE, MF_BYCOMMAND)
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
SubForm sub = new SubForm();
sub.Show();
sub.Dock = DockStyle.Fill;
sub.Show();
sub.Dock = DockStyle.Fill;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询