using System;
using System.Windows.Forms;
using UAS_MES_NEW.Properties;

namespace UAS_MES_NEW.CustomControl.ButtonUtil
{
    public partial class CloseButton : Button
    {

        public CloseButton()
        {
            InitializeComponent();
            this.Click += CloseButton_Click;
            this.Image = Resources._2_0btn_36;
        }

        private void CloseButton_Click(object sender, EventArgs e)
        {
            //获取打开窗体的集合,找到当前的Form的名称然后关闭
            FormCollection fmCollection = Application.OpenForms;
            Control c = this.Parent;
            fmCollection[c.Name].Close();
        }
    }
}