void editorForm_FormClosing(object sender, FormClosingEventArgs e) { LizardSkinEditorControl editor = (LizardSkinEditorControl)editorForm.Controls[0]; if (editor.IsDirty) { DialogResult result = MessageBox.Show(editorForm, "Current style contains unsaved changed. Do you want to close anyway?", editorForm.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question); e.Cancel = (result == DialogResult.No); } }
public void ShowSkinEditor(SkinnedForm owningForm) { LizardSkinEditorControl editor; if (editorForm == null || editorForm.IsDisposed) { editorForm = new Form(); components.Add(editorForm); editorForm.Text = "Form Style Editor"; // editorForm.FormBorderStyle = FormBorderStyle.SizableToolWindow; editorForm.Size = new System.Drawing.Size(700, 400); editor = new LizardSkinEditorControl(); editor.Dock = DockStyle.Fill; editorForm.Controls.Add(editor); editorForm.FormClosing += new FormClosingEventHandler(editorForm_FormClosing); editorForm.FormClosed += new FormClosedEventHandler(editorForm_FormClosed); } else { editor = (LizardSkinEditorControl)editorForm.Controls[0]; } editor.OwningForm = owningForm; editorForm.Show(); }