using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace UAS_MES_NEW.CustomControl.BaseForm { public partial class ClickToCloseForm : Form { String text1; public ClickToCloseForm(String text) { InitializeComponent(); text1 = text; } private void ClickToCloseForm_MouseClick(object sender, MouseEventArgs e) { // 在鼠标点击事件中关闭窗口 Close(); } private void ClickToCloseForm_Load(object sender, EventArgs e) { MouseClick += ClickToCloseForm_MouseClick; label1.Text = text1; } } }