如何使一个窗口关闭的关闭按钮形式使用C#编码 [英] How to make the Close button disabled in a windows Form using C# coding

查看:100
本文介绍了如何使一个窗口关闭的关闭按钮形式使用C#编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每一个。我只是想使用C#.net一个按钮单击事件禁用关闭按钮。我想对于这一点,但不能正确地确定这是正确的。

 私人无效的button1_Click(对象发件人,EventArgs五)
{
this.ControlBox = FALSE;
}


解决方案

 私人const int的dis_close_button =为0x200; 
保护覆盖的CreateParams的CreateParams
{
得到
{
的CreateParams ObjCP = base.CreateParams;
ObjCP.ClassStyle = ObjCP.ClassStyle | dis_close_button;
返回ObjCP;
}
}

尝试,这...


every one. I just want to make the Close button disabled on a button click event using C#.net. I am trying for this but not correctly sure it's correct.

  private void button1_Click(object sender, EventArgs e)
    {
        this.ControlBox = false;
    }

解决方案

private const int dis_close_button = 0x200;
    protected override CreateParams CreateParams
    {
        get
        {
            CreateParams ObjCP = base.CreateParams;
            ObjCP.ClassStyle = ObjCP.ClassStyle | dis_close_button;
            return ObjCP;
        }
    }

Try, this...

这篇关于如何使一个窗口关闭的关闭按钮形式使用C#编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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