public void DoShowDialog(ICustPanel panel) { Panel realPanel = (Panel)panel; System.Drawing.Size panelSize = panel.PreferredSize; if (panelSize != System.Drawing.Size.Empty) { Size = panelSize; } else { Width = 300; Height = 400; } Text = realPanel.Text; realPanel.Dock = DockStyle.Fill; Controls.Add(realPanel); panel.BeforeShow(); while (true) { if (ShowDialog() != DialogResult.OK) { Controls.Remove(realPanel); return; } if (panel.AfterShow()) break; continue; } Controls.Remove(realPanel); }
public void DoShowDialog(ICustPanel panel) { Panel realPanel = (Panel)panel; System.Drawing.Size panelSize = panel.PreferredSize; if (panelSize != System.Drawing.Size.Empty) { Size = panelSize; } else { Width = 300; Height = 400; } Text = realPanel.Text; realPanel.Dock = DockStyle.Fill; Controls.Add(realPanel); panel.BeforeShow(); while (true) { if (ShowDialog() != DialogResult.OK) { Controls.Remove(realPanel); return; } if (panel.AfterShow()) { break; } continue; } Controls.Remove(realPanel); }