简体   繁体   English

禁用关闭按钮 VB.NET

[英]Disabling close button VB.NET

Is there a possible way in VB.NET to disable the close button of the main form as I've seen in many installer, I don't want to hide it, I want to completely disable it! VB.NET 中是否有一种可能的方法来禁用主窗体的关闭按钮,就像我在许多安装程序中看到的那样,我不想隐藏它,我想完全禁用它!

Thanks in advance提前致谢

Since the blog post in the accepted answer has been taken offline, the following is a solution for C#.NET:由于已接受答案中的博文已下线,以下是针对 C#.NET 的解决方案:

http://www.codeproject.com/Articles/20379/Disabling-Close-Button-on-Forms http://www.codeproject.com/Articles/20379/Disabling-Close-Button-on-Forms

Using the C#.NET to VB.NET converter on DeveloperFusion, the equivalent VB.NET solution is:在 DeveloperFusion 上使用 C#.NET 到 VB.NET转换器,等效的 VB.NET 解决方案是:

Private Const CP_NOCLOSE_BUTTON As Integer = &H200
Protected Overrides ReadOnly Property CreateParams() As CreateParams
    Get
        Dim myCp As CreateParams = MyBase.CreateParams
        myCp.ClassStyle = myCp.ClassStyle Or CP_NOCLOSE_BUTTON
        Return myCp
    End Get
End Property

Set ControlBox property of the form to false将表单的 ControlBox 属性设置为 false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM