7个回答
推荐于2017-09-20 · 知道合伙人软件行家
关注
展开全部
在VB6.0窗体中去掉关闭按钮的方法:
在窗体属性窗口设置ControlBox 属性为False。
ControlBox 属性,返回或设置一个值,指示在运行时控制菜单框是否在窗体中显示。在运行时为只读。
在窗体属性窗口设置BorderStyle 属性为0,使窗体没有边框或与边框相关的元素。
在窗体的UnLoad事件代码中使用Cancel = -1语句,使关闭按钮失效。
Private Sub Form_Unload(Cancel As Integer)
Cancel = -1 '或Cancel = True
End Sub
展开全部
在属性窗口中切换到窗体的属性设置,然后在 BorderStyle 选项里选择
0-none 就可以把那个讨厌的小按钮给删了,不过整个标题栏也没有了!
0-none 就可以把那个讨厌的小按钮给删了,不过整个标题栏也没有了!
参考资料: lvcii
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
controlbox设为FALSE
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Option Explicit
Private Const MF_BYCOMMAND = &H0&
Private Const MF_BYPOSITION = &H400&
Private Const MF_DISABLED = &H2&
Private Const MF_ENABLED = &H0&
Private Const MF_GRAYED = &H1&
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 Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Private Sub Command1_Click()
Call DisableCloseMenu(Me.hwnd)
End Sub
Private Sub Command2_Click()
Call EnableCloseMenu(Me.hwnd)
End Sub
Private Function DisableCloseMenu(ByVal dwMenu As Long) As Boolean
Dim hMenu As Long
Dim nCount As Long
DisableCloseMenu = False
hMenu = GetSystemMenu(dwMenu, False)
If hMenu <> 0 Then
nCount = GetMenuItemCount(hMenu)
If RemoveMenu(hMenu, nCount - 1, MF_DISABLED Or MF_BYPOSITION) <> 0 Then
If DrawMenuBar(dwMenu) <> 0 Then
DisableCloseMenu = True
End If
End If
End If
End Function
Private Function EnableCloseMenu(ByVal dwMenu As Long) As Boolean
Dim hMenu As Long
EnableCloseMenu = False
hMenu = GetSystemMenu(dwMenu, True)
If hMenu = 0 Then
If DrawMenuBar(dwMenu) <> 0 Then
EnableCloseMenu = True
End If
End If
End Function
Private Const MF_BYCOMMAND = &H0&
Private Const MF_BYPOSITION = &H400&
Private Const MF_DISABLED = &H2&
Private Const MF_ENABLED = &H0&
Private Const MF_GRAYED = &H1&
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 Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Private Sub Command1_Click()
Call DisableCloseMenu(Me.hwnd)
End Sub
Private Sub Command2_Click()
Call EnableCloseMenu(Me.hwnd)
End Sub
Private Function DisableCloseMenu(ByVal dwMenu As Long) As Boolean
Dim hMenu As Long
Dim nCount As Long
DisableCloseMenu = False
hMenu = GetSystemMenu(dwMenu, False)
If hMenu <> 0 Then
nCount = GetMenuItemCount(hMenu)
If RemoveMenu(hMenu, nCount - 1, MF_DISABLED Or MF_BYPOSITION) <> 0 Then
If DrawMenuBar(dwMenu) <> 0 Then
DisableCloseMenu = True
End If
End If
End If
End Function
Private Function EnableCloseMenu(ByVal dwMenu As Long) As Boolean
Dim hMenu As Long
EnableCloseMenu = False
hMenu = GetSystemMenu(dwMenu, True)
If hMenu = 0 Then
If DrawMenuBar(dwMenu) <> 0 Then
EnableCloseMenu = True
End If
End If
End Function
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
通过窗体属性修改
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询