public override void SetFormState(Form form) { form.WindowState = FormWindowState.Normal; form.FormBorderStyle = FormBorderStyle.FixedDialog; form.FormClosing += (sender, e) => { if (form.DialogResult == DialogResult.OK && KeyValue.IsNullOrEmpty()) { UIPublic.ShowWarningDialog("键值不能为空"); e.Cancel = true; } }; }