vb.net取消关闭按钮,vb取消按钮代码

VB.NET如何使最大化关闭按钮消失

this.ControlBox = false//最小化、最大化、关闭按钮全部消失

创新互联建站专注于播州网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供播州营销型网站建设,播州网站制作、播州网页设计、播州网站官网定制、小程序制作服务,打造播州网络公司原创品牌,更为您提供播州网站排名全网营销落地服务。

this.MinimizeBox = false//最小化按钮消失

this.MaximizeBox = false//最大化按钮消失

如果你只想隐藏关闭按钮的话可以参考

VB.net如何判断用户是否按了inputbox对话框的取消按钮?

如果用户单击 Cancel(取消),则InputBox函数返回一个长度为零的字符串 (""),可以根zhidao据这个情况进行判断,如果BH="",则用户按内了“取消容”键,但如果用户把输入的内容清空,这时按“确定”和按“取消”一样,都返回一个长度为的字符串。

vb.net让窗口关闭时,取消关闭,隐藏窗口

问题补充:我用VB.NET写的,FORM2用来实现数据采样并显示实时曲线,关闭后再'取消FORM2的关闭 这样就把FORM2隐藏起来了,需要调出来的时候只需以下代码

VB2008 如何取消窗体的关闭按钮

设置ControlBox为False是可以的,不过全部按钮都会消失(包括最小化,最大化)

用API可以单独把关闭按钮干掉……

'VB.NET Code

Public Class Form1

Private Declare Function GetSystemMenu Lib "User32 " (ByVal hwnd As Integer, ByVal bRevert As Long) As Integer

Private Declare Function RemoveMenu Lib "User32 " (ByVal hMenu As Integer, ByVal nPosition As Integer, ByVal wFlags As Integer) As Integer

Private Declare Function DrawMenuBar Lib "User32 " (ByVal hwnd As Integer) As Integer

Private Declare Function GetMenuItemCount Lib "User32 " (ByVal hMenu As Integer) As Integer

Private Const MF_BYPOSITION = H400

Private Const MF_DISABLED = H2

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim hMenu As Integer, nCount As Integer

hMenu = GetSystemMenu(Me.Handle.ToInt32, 0)

nCount = GetMenuItemCount(hMenu)

'Debug.Print(nCount)

Call RemoveMenu(hMenu, nCount - 1, MF_DISABLED Or MF_BYPOSITION)

DrawMenuBar(Me.Handle.ToInt32)

End Sub

End Class

'VB6 code =============================================================

Private Declare Function GetSystemMenu Lib "User32 " (ByVal hwnd As Long, ByVal bRevert As Long) As Integer

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 Const MF_BYPOSITION = H400

Private Const MF_DISABLED = H2

Private Sub Form1_Load()

Dim hMenu As Long, nCount As Long

hMenu = GetSystemMenu(Me.hWnd, 0)

nCount = GetMenuItemCount(hMenu)

'Debug.Print nCount

Call RemoveMenu(hMenu, nCount - 1, MF_DISABLED Or MF_BYPOSITION)

DrawMenuBar Me.hWnd

End Sub

VB.NET中,右上角的关闭按钮走的什么事件

Private Sub Form2_FormClosed(sender As Object, e As FormClosedEventArgs) Handles Me.FormClosed

End    '退出后关闭软件

End Sub

'点击关闭按钮时弹出对话框判断是否退出

Private Sub Form2_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing

'经典判断关闭法

If MessageBox.Show("是否退出?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question,

MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.Cancel Then

e.Cancel = True

Else

e.Cancel = False

End If

End Sub

vb中如何把窗体的关闭按钮去掉,怎样设置这个关闭按钮是退出窗体还是退出整个程序

把窗体的ControlBox 属性设为False

点关闭就是卸载窗体,如果程序只有一个窗体自动结束

退出当前窗体(精确到实例):Unload Me

退出程序:End


新闻标题:vb.net取消关闭按钮,vb取消按钮代码
链接地址:http://abwzjs.com/article/hddhic.html