-
-
Notifications
You must be signed in to change notification settings - Fork 10
Simplify.Windows.Forms
Alexanderius edited this page Jun 27, 2026
·
1 revision
Provides additional System.Windows.Forms controls and helpers: message boxes, control validators, a list view column sorter, a nullable date-time picker, and a topmost progress bar.
Available at NuGet as binary package
Targets net6.0-windows, netcoreapp3.1, and net48. Depends on Simplify.Resources for string-table-based messages.
// Shows a message box with the given text, icon and buttons.
public static DialogResult ShowMessageBox(string text,
MessageBoxIcon icon = MessageBoxIcon.Information,
MessageBoxButtons buttons = MessageBoxButtons.OK);
// Shows a message box with text loaded from a string table (resource) record.
public static DialogResult ShowStMessageBox(string stringTableRecordName,
MessageBoxIcon icon = MessageBoxIcon.Information,
MessageBoxButtons buttons = MessageBoxButtons.OK);Validates a list of controls for a filled/existing value, enabling or disabling a result control accordingly.
// resultStatusControl is enabled/disabled based on the validation of checkItems.
public class ControlsValidator(Control resultStatusControl, params Control[] checkItems)
{
public void EnableValidation();
}var validator = new ControlsValidator(buttonOk, textBoxName, comboBoxCity);
validator.EnableValidation();Validates a list of TextBox controls for a filled value, with optional invalid-value color highlighting.
public TextBoxesValidator(Control resultStatusControl, params TextBox[] checkItems);
public TextBoxesValidator(bool enableColorHightlight, Control resultStatusControl, params TextBox[] checkItems);
public void EnableValidation();
public void DisableValidation();
// Text-box numeric value validation event handler.
public static void OnTextBoxNumberValidated<T>(object sender, CancelEventArgs e);An IComparer implementation for sorting ListView columns.
public class ListViewColumnSorter : IComparer
{
// Number of the column to sort (defaults to 0).
public int SortColumn { get; set; }
// Order of sorting (e.g. Ascending or Descending).
public SortOrder Order { get; set; }
public int Compare(object x, object y);
}listView.ListViewItemSorter = new ListViewColumnSorter { SortColumn = 1, Order = SortOrder.Ascending };A DateTimePicker that supports a null value.
public class NullableDateTimePicker : DateTimePicker
{
// The text shown in the control when the value is null.
public string NullValue { get; set; }
// The nullable DateTime value of the control.
public new DateTime? Value { get; set; }
}A topmost progress bar Form control.
public partial class TopmostProgressBar : Form;