vb.net取消关闭 vbs关闭窗口代码-成都快上网建站

vb.net取消关闭 vbs关闭窗口代码

vb.net中窗体中的缩小,放大,关闭可以去掉吗?

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

创新互联是一家专业从事网站设计、网站制作、网页设计的品牌网络公司。如今是成都地区具影响力的网站设计公司,作为专业的成都网站建设公司,创新互联依托强大的技术实力、以及多年的网站运营经验,为您提供专业的成都网站建设、营销型网站建设及网站设计开发服务!

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 打开文件之后怎样关闭?

你都用.net了,这是vb的旧语法,不推荐使用。vb.net是面向对象的,推荐您使用

dim OpF as new io.filestream(OpenFileDialog1.FileName, IO.FileMode.Open)

...

OpF.close

或是

Using OpF as new io.filestream(OpenFileDialog1.FileName, IO.FileMode.Open)

...

End Using

但是你如果执意要用的话,也可以:

FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input)

...

FileClose(1) '这里可以同时关闭多个文件号,文件号之间用,隔开


本文名称:vb.net取消关闭 vbs关闭窗口代码
分享URL:http://kswjz.com/article/dojpesc.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流