VB 让窗口的关闭按钮变灰
4个回答
展开全部
你想要变灰也可以、禁用也可以,方法如下:在要禁用的窗体内增加以下代码块即可。
【方法一:禁用而不变灰】
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If Not Cancel Then Cancel = 1
End Sub
【方法二:变灰及禁用】
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 Sub Form_Load()
RemoveMenu GetSystemMenu(Form1.hWnd, 0), &HF060, &H1000&
End Sub
【方法一:禁用而不变灰】
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If Not Cancel Then Cancel = 1
End Sub
【方法二:变灰及禁用】
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 Sub Form_Load()
RemoveMenu GetSystemMenu(Form1.hWnd, 0), &HF060, &H1000&
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
好像不行,除非API,不过可以不显示X
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你是说自身(x)按钮变灰或禁用,还是其他窗口?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询