public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { Color defaultDialogColor = Color.Black; if (value != null) { defaultDialogColor = (Color)value; } VisualColorDialog colorDialog = new VisualColorDialog(defaultDialogColor); if (colorDialog.ShowDialog() == DialogResult.OK) { defaultDialogColor = colorDialog.Color; } return(defaultDialogColor); }
private void BtnRunTest_Click(object sender, EventArgs e) { VisualForm _formToOpen; switch (_unitTest) { case UnitTests.VisualForm: { _formToOpen = new VisualForm($@"{nameof(VisualForm)} Test"); _formToOpen.ShowDialog(); break; } case UnitTests.VisualControlBox: { _formToOpen = new VisualControlBoxTest(); _formToOpen.ShowDialog(); break; } case UnitTests.VisualListView: { _formToOpen = new VisualListViewTest(); _formToOpen.ShowDialog(); break; } case UnitTests.VisualMessageBox: { _formToOpen = new VisualMessageBoxTest(); _formToOpen.ShowDialog(); break; } case UnitTests.VisualInputDialog: { VisualInputDialog inputDialog = new VisualInputDialog($@"{nameof(VisualInputDialog)} Test"); if (inputDialog.ShowDialog() == DialogResult.OK) { ConsoleEx.WriteDebug(inputDialog.InputResult); } break; } case UnitTests.VisualExceptionDialog: { VisualExceptionDialog.Show(new Exception("Your custom exception message.")); break; } case UnitTests.VisualColorDialog: { VisualColorDialog colorDialog = new VisualColorDialog(); if (colorDialog.ShowDialog() == DialogResult.OK) { ConsoleEx.WriteDebug(colorDialog.Color); } break; } case UnitTests.ClipboardTest: { _formToOpen = new ClipboardTest(); _formToOpen.ShowDialog(); break; } default: { throw new ArgumentOutOfRangeException(); } } }