成都网站建设设计

将想法与焦点和您一起共享

vb.net窗体去掉关闭 vb关闭程序窗体的代码

VB.NET是如何关闭窗体

VB.NET关闭当前窗体me.close()

十载的头屯河网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。成都全网营销的优势是能够根据用户设备显示端的尺寸不同,自动调整头屯河建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。成都创新互联从事“头屯河网站设计”,“头屯河网站推广”以来,每个客户项目都认真落实执行。

其它窗体用:窗体名.close(),例如:form2.close()

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中窗体中的缩小,放大,关闭可以去掉吗?

可以,属性controlBox 为false可以去掉三个按钮,另外还有maximize,minimize 可以分别控制最大化和最小化按钮的显示。

vb.net如何打开一个新窗体后关闭上一个窗体

1、如果上一个窗体是程序的主窗体(默认是程序的第一个窗体),

则不能关闭这个窗体,只能隐藏(Me.Hide())这个窗体,否则整

个程序就被关掉了。

2、如果上一个窗体不是程序的主窗体,可以用Me.Close()

关闭。

VB.NET 窗体关闭问题 用的是vs2013

首先这个应该放在 FormClosing 事件中。

其次,因为你 Else 之后没有忽略窗体关闭的请求。

应该再加一句 e.Cancel = True,表示告诉系统,我取消关闭窗体这个操作了。


当前文章:vb.net窗体去掉关闭 vb关闭程序窗体的代码
URL分享:http://chengdu.cdxwcx.cn/article/hjgogi.html