禁用Vb.Net中的关闭按钮[X] [英] Disable Close Button[X] in the Vb.Net

查看:515
本文介绍了禁用Vb.Net中的关闭按钮[X]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我在vb.net中遇到如下问题。

i想在vb.net中禁用MDI的关闭按钮[X]。

i不要想设置控制箱属性。

否则它不显示图标。

解决方案

它在C#中,但是它很短,应该很容易转换(尝试DeveloperFusion - 他们有一个在线翻译):

禁用表单上的关闭框 [ ^ ]


您只需要将此代码放入后面的表单代码中/>

 受保护的 覆盖  ReadOnly  属性 CreateParams() As  CreateParams 
获取
Dim param 作为 CreateParams = MyBase .CreateParams
param.ClassStyle = param.ClassStyle & H200
返回 param
结束 获取
结束 物业



,这将禁用(x)关闭按钮。


您好,

以下是代码 -

 私有  Const  CP_NOCLOSE_BUTTON 作为 整数 =& H200 
受保护的 重载 覆盖 ReadOnly 属性 CreateParams() As CreateParams
获取
Dim myCp 作为 CreateParams = MyBase .CreateParams
myCp.ClassStyle = myCp.ClassStyle CP_NOCLOSE_BUTTON
返回 myCp
结束 获取
结束 属性


Hello, i have problem in vb.net like as below.
i want to disable Close Button[X]of MDI in vb.net.
i don't want to set controlbox property.
otherwise it will not showing icon.

解决方案

It's in C#, but it's pretty short and should be easy to convert (try DeveloperFusion - they have an online translator):
Disable the Close box on a form[^]


You just need to put this code into your form code behind

Protected Overrides ReadOnly Property CreateParams() As CreateParams
    Get
        Dim param As CreateParams = MyBase.CreateParams
        param.ClassStyle = param.ClassStyle Or &H200
        Return param
    End Get
End Property


and that will disable the (x) close button.


Hi,
Following is the code-

Private Const CP_NOCLOSE_BUTTON As Integer = &H200
Protected Overloads 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


这篇关于禁用Vb.Net中的关闭按钮[X]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆