Rop.Winforms10 1.0.1

dotnet add package Rop.Winforms10 --version 1.0.1
                    
NuGet\Install-Package Rop.Winforms10 -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rop.Winforms10" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rop.Winforms10" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Rop.Winforms10" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Rop.Winforms10 --version 1.0.1
                    
#r "nuget: Rop.Winforms10, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Rop.Winforms10@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Rop.Winforms10&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Rop.Winforms10&version=1.0.1
                    
Install as a Cake Tool

Rop.Winforms10

Base classes and controls for WinForms on .NET 10. Provides reusable forms, key-value combobox/listbox controls, item collection unification, and various helpers.

Installation

dotnet add package Rop.Winforms10

Features

Base Forms (Rop.Winforms10)

Form inheritance hierarchy with built-in behavior:

Form
 └── FormSc            — Base form with Win11 rounded corners, result pattern (IForm10)
      └── FormDownPanel   — Adds bottom panel with Ok/Exit buttons
           ├── FormDialog       — Fixed dialog (CenterParent, no minimize/maximize)
           └── FormUpDownPanel  — Adds top panel + main content panel
  • FormSc — Base form enabling Windows 11 rounded corners via DwmSetWindowAttribute. Implements IForm10 providing SynchronizationContext, result handling (Result<T>, VoidResult), cross-thread Post/Send, and built-in ShowError/ShowInfo/ShowYesNo dialogs.
  • FormDownPanel — Form with a configurable bottom button bar (Exit + optional Ok button). Auto-positions buttons on resize.
  • FormDialog — Modal dialog preconfigured as FixedDialog, CenterParent, always on top. Hides minimize/maximize/show-in-taskbar.
  • FormUpDownPanel — Extends FormDownPanel with a top panel and a main content panel. BackColor syncs between panels.
public partial class MyForm : FormDownPanel
{
    public MyForm()
    {
        BtnOkVisible = true;            // show Ok button
        ExitButtonClick += (s, e) => DoExit();
        OkButtonClick += (s, e) => DoExitOk(myResult);
    }
}

// In the calling code:
var result = await myForm.ShowDialogAsync();  // returns Result<T>

AbsController<T>

Abstract controller base class for forms. Subscribes to Form.Shown to call Init() and InitAsync():

public class MyController : AbsController<MyForm>
{
    public MyController(MyForm form) : base(form) { }

    protected override void Init() { /* sync init */ }
    protected override async ValueTask InitAsync() { /* async init */ }
}

IForm10 Interface (Rop.Winforms10.Helper)

Common interface for forms providing result pattern integration:

IResult FormResult { get; set; }
Result<T> GetResult<T>();
VoidResult GetVoidResult();
void DoExitOk();
void DoExitOk<T>(T result);
void DoExitFailed(Error error);
void ShowError(string error);
void ShowInfo(string info);
DialogResult ShowYesNo(string msg, string caption);
Task LockPost(Action action);     // cross-thread post with await
void Post(Action action);
void Send(Action action);

KeyValue Controls (Rop.Winforms10.KeyValueListBox)

Controls that display items implementing IKeyValue (from Rop.IKeyValue), rendering both a key and a descriptive value side by side with full owner-draw support.

  • KeyValueListBox — ListBox for IKeyValue instances. Owner-drawn with key/value columns, row color sets (normal/selected/alt), icon slots per row.
  • KeyValueComboBox — Drop-down ComboBox for IKeyValue instances. Same rendering engine as the list box.
  • KeyValueLabel — Single-item read-only label using the KeyValue draw engine (shows one IKeyValue).

All three controls share a common draw pipeline (IKeyValueControlDraw) with granular draw events:

Event Purpose
DrawKeyValueItem Full item background + layout
DrawKeyItem Key column text rendering
DrawValueItem Value column text rendering
DrawLeftIcon / DrawRightIcon Icon slots (left/right of key)
PostDrawKeyItem / PostDrawValueItem Post-draw overlays
using Rop.Winforms10.KeyValueListBox;

// Populate a KeyValueComboBox with IKeyValue items
keyValueCombo.Items.AddRange(new IKeyValue[]
{
    new FooKeyValue("ES", "Spain"),
    new FooKeyValue("FR", "France"),
    new FooKeyValue("IT", "Italy")
});

// Get selected key
string selectedKey = keyValueCombo.SelectedKey;

// Configure row colors
keyValueCombo.RowStyleColorSet = ColorSet.Default;
keyValueCombo.RowStyleSelectedColorSet = ColorSet.DefaultSel;
keyValueCombo.RowStyleAltColorSet = ColorSet.DefaultAlt;

ICanBeKeyValue Interface (Rop.Winforms10.ListCombobox)

Rich interface for controls that work with IKeyValue items. Both CompatibleListBox and CompatibleComboBox implement it:

// Key/value lookup
IKeyValue? FindKey(string key);
int FindKeyIndex(string key);
bool KeyExists(string key);
string SelectedKey { get; set; }
int SelectedIntKey { get; set; }
IKeyValue? SelectedKeyValue { get; }

// Update pipeline with events
event EventHandler<UpdateItemsEventArgs> UpdatePreItems;
event EventHandler<UpdateItemsEventArgs> UpdateItems;
event EventHandler<UpdateItemsEventArgs> UpdatePostItems;
event EventHandler<OrderItemsEventArgs> UpdateOrderItems;
bool StopUpdates { get; set; }  // suppress updates
void CancelUpdate();

Compatible Items (Rop.Winforms10.ListCombobox)

Unified item collection that wraps both ComboBox.ObjectCollection and ListBox.ObjectCollection behind a common interface.

  • CompatibleComboBox — ComboBox with CompatibleItems (replaces base.Items).
  • CompatibleListBox — ListBox with CompatibleItems.
  • CompatibleItems — Implements IList wrapping the native collection, adds AddRange(IEnumerable).

Both controls implement IHasCompatibleItems giving access to a unified Items property and GetSelectedItem() / GetItem(int) / GetItemsCount().

// CompatibleItems works with both controls identically
compatibleCombo.Items.AddRange(myKeyValueCollection);
compatibleListBox.Items.AddRange(myKeyValueCollection);

// Unified access
object? selected = compatibleCombo.GetSelectedItem();
int count = compatibleCombo.GetItemsCount();

Controls (Rop.Winforms10.Controls)

  • ConcurrentBar — Progress bar control with marquee and determinate modes. Configurable bar height, colors, border radius, and text format ({0}%). Uses a timer for marquee animation.
  • NullDateOnlyPickerDateTimePicker subclass supporting nullable DateOnly?. Tracks value changes with a _trackchanges flag to avoid re-entrant OnValueChanged.
var bar = new ConcurrentBar { Maximum = 100, Value = 42, UsePercent = true };
var picker = new NullDateOnlyPicker { Value = DateOnly.FromDateTime(DateTime.Today) };

Decorators (Rop.Winforms10.Decorators)

  • EnumComboBoxView<T> — Wraps a ComboBox to display enum values with [Display(Name="...")] attribute support. Provides GetValue() / SetValue().
var view = new EnumComboBoxView<MyEnum>(myComboBox);
MyEnum? selected = view.GetValue();
view.SetValue(MyEnum.SomeValue);

Helpers (Rop.Winforms10.Helper)

  • WinFormsHelper — Extensions: IsRealDesignerMode() (detects VS designer), ForceSetVisibleCore(), FindControlAtPoint(), default icon/font reflection accessors, SendMessage P/Invoke.
  • ClipboardEx — Parse CF_DIBV5 clipboard format into Bitmap. Struct-to-bytes conversion.
  • SlimControlDialogDecorator — Decorates a control with a popup dialog positioned below it. Supports fade-out animation, mouse-leave detection via MouseHook.
  • SortableBindingList<T>BindingList<T> with column-header-click sort support (in-memory sort via List<T>.Sort).
  • MouseHook — Global mouse hook service. Captures mouse down/up/action events even outside the application window.
  • ControlPositionHelper — Extension methods SetLeft, SetTop, SetWidth, SetHeight that return bool (true if changed).
  • TypeConvertibleRepository / TypeConverter — Reflection-based type-to-string conversion with sorted properties.
  • CategoryHelper — Constants for standard CategoryAttribute strings (Action, Appearance, Behavior, Data, Layout, Mouse, etc.).
  • Win32 / Win32.WM — Extensive Win32 constants and window message definitions.
  • DrawItemEventHelper / FullNameHelper / Resources / TabControlHelper — Miscellaneous utility classes.

Dependencies

Package Purpose
Rop.Results9 Result pattern (IForm10 form results)
Rop.IKeyValue IKeyValue interface for key-value controls
Rop.IncludeFrom Source generator for partial class composition
Rop.Winforms10.Helpers Drawing/geometry/font helpers (project reference)

Requirements

  • .NET 10 (net10.0-windows)
  • Windows Forms (UseWindowsForms=true)

License

GPL-3.0-or-later

Author

Ramon Ordiales Plaza

Product Compatible and additional computed target framework versions.
.NET net10.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 138 6/25/2026