zoukankan      html  css  js  c++  java
  • c# 禁用和启用windows form窗体上的关闭按钮

    禁用和启用windows form窗体上的关闭按钮

     

    1public partial class Form1 : Form
    2    
    {
    3        private bool isEnableCloseButton = false
    ;
    4        public Form1(string
    strFlag)
    5        
    {
    6
                 InitializeComponent();
    7            if (strFlag == "no"
    )
    8            
    {
    9                this.lbl_CloseButtonIsEnabled.Text = "窗体右上角关闭按钮无效"
    ;
    10                this.isEnableCloseButton = false
    ;
    11             }

    12            else
    13            {
    14                this.lbl_CloseButtonIsEnabled.Text = "可以通过窗体右上角关闭按钮 关闭窗体"
    ;
    15                this.isEnableCloseButton = true
    ;
    16             }

    17         }

    18
    19        protected override
    CreateParams CreateParams
    20        
    {
    21            get

    22            {
    23                if
    (isEnableCloseButton)
    24                
    {
    25                     CreateParams parameters = base
    .CreateParams;
    26                    return
    parameters;
    27                 }

    28                else
    29                {
    30      int CS_NOCLOSE = 0x200
    ;
    31                     CreateParams parameters = base
    .CreateParams;
    32                     parameters.ClassStyle |=
    CS_NOCLOSE;
    33                    return
    parameters;                    
    34                 }

    35             }

    36         }

    37}

  • 相关阅读:
    Redis设计与实现第一部分:第5章:Redis 跳跃表
    根据临时表修改主表的某字段数据根据主表的主键
    Redis设计与实现第一部分:第2章:简单动态字符串SDS
    Redis
    MySQL的访问控制与用户管理
    MySQL字符集和语言的基础知识
    生成日志文件
    Python进阶09 动态类型
    Python进阶08 异常处理
    Python进阶07 函数对象
  • 原文地址:https://www.cnblogs.com/sql4me/p/1442851.html
Copyright © 2011-2022 走看看