zoukankan      html  css  js  c++  java
  • User Control Closing Event 武胜

    User Control Closing Event

    using System.Windows.Forms;

     

    namespace UserControlClosingEvent

    {

        public partial class UserControl1 : UserControl

        {

            public UserControl1()

            {

                InitializeComponent();

            }

     

            protected override void OnCreateControl()

            {

                base.OnCreateControl();

                this.ParentForm.FormClosing += new FormClosingEventHandler(ParentForm_FormClosing);

            }

     

            void ParentForm_FormClosing(object sender, FormClosingEventArgs e)

            {

                if (MessageBox.Show("是否关闭父窗体?", "关闭父窗体?",

                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)

                {

                    e.Cancel = true;

                }

            }

        }

    }

  • 相关阅读:
    Source Insight新建工程文件
    移植3.4.2内核之韦东山笔记
    移植最新u-boot(裁剪和修改默认参数)
    C++与C语言在结构体上的区别
    VIP之Switch
    VIP之CSC
    VIP之Scaler
    VIP之FrameBuffer
    VIP之MixerII
    VIP之Clipper
  • 原文地址:https://www.cnblogs.com/zeroone/p/2091401.html
Copyright © 2011-2022 走看看