/// <summary> /// Display a new dialog /// </summary> /// <param name="container">The control that contains the control to change</param> /// <param name="control">The control to display</param> /// <param name="modal">True to make it a modal dialog</param> public static void DisplayDialog(Control container, Form control, bool modal) { if (container.InvokeRequired) { DisplayDialogCallback d = DisplayDialog; try { container.Invoke(d, new object[] { container, control, modal }); } catch (Exception) { } } else { if (modal) { control.ShowDialog(container); } else { control.Show(container); } } }
public void DisplayDialog(Form control, bool modal) { if (InvokeRequired) { DisplayDialogCallback d = DisplayDialog; try { Invoke(d, new object[] { control, modal }); } catch (Exception) { } } else { if (modal) { control.ShowDialog(this); } else { control.Show(this); } } }