๐น Kt-Brush
Modern Brush System for WinForms
The Problem with Traditional WinForms UI
Let's be honest: WinForms wasn't built for modern UI design.
In 2025, users expect applications that rival web experiencesโsmooth gradients, dynamic color schemes, and fluid visual transitions. Yet WinForms developers are stuck with the same limited brush system from the early 2000s:
What's Wrong with Standard WinForms Brushes?
Limited Gradient Support
Creating gradients requires manual
LinearGradientBrushinstantiation for every controlNo declarative way to define gradients in the designer
Angle adjustments mean rewriting entire brush initialization code
Rectangle dependency makes gradients rigid and hard to reuse
Poor Developer Experience
Brushes aren't property-bindable in a meaningful way
No type conversion support for seamless string/color conversions
Zero support for empty/transparent state checking
Manual cleanup and disposal required everywhere
Design-Time Nightmare
Properties don't refresh properly when changed
No visual feedback in the designer
Can't serialize complex brush configurations
TypeConverter support is either missing or broken
No Modern Patterns
No fluent API for brush manipulation
Can't chain operations or create brush variations
No implicit conversions between Color and Brush types
Impossible to create reusable brush presets
The Real Cost
These limitations force developers to choose between:
Beautiful UI - Write hundreds of lines of boilerplate brush management code
Fast Development - Ship applications that look dated and unprofessional
Modern client applications demand visual sophistication. When your competition is delivering Electron apps with CSS gradients and your desktop app looks like it's from Windows XP, you've already lost.
Introducing KtBrush
KtBrush is a complete reimagining of the WinForms brush system, designed for modern UI development with developer experience as a first-class concern.
Core Philosophy
Declarative First - Define what you want, not how to build it
Type-Safe Everything - Leverage C# features for compile-time safety
Designer-Friendly - Full PropertyGrid integration with live updates
Zero Boilerplate - Implicit conversions eliminate repetitive code
Key Features
๐จ Unified Brush Abstraction
Three brush types, one elegant interface:
๐ Automatic Type Conversions
Stop writing conversion code. KtBrush handles it:
โก Fluent Gradient Operations
Manipulate gradients like you manipulate data:
๐ Smart State Detection
Built-in checks for common scenarios:
๐ฏ Designer Integration
Full PropertyGrid support with proper refresh behavior:
NotifyParentProperty - Parent controls update automatically
RefreshProperties - Triggers repaints when needed
Type Conversion - String input works seamlessly
Expandable Properties - Gradient properties expand in place
๐ Render Anywhere
Single API for multiple rendering targets:
๐ Bonus: Squircle Support
Modern rounded rectangles with a single method:
Real-World Examples
Before: Traditional WinForms
After: With KtBrush
90% less code. 100% more maintainable.
Advanced Patterns
Conditional Brushes
Dynamic Gradient Rotation
Serialization-Ready
JSON Integration
Technical Highlights
Architecture
Abstract Base Class -
KtBrushprovides common interfaceSealed Implementations -
KtBrushNone,KtBrushSolid,KtBrushGradientProperty Change Notifications - Full
INotifyPropertyChangedsupportImplicit Operators - Seamless type conversions
Type Safety
No magic strings
Compile-time type checking
Null-safe throughout
Explicit empty state handling
Performance
Lazy rendering - brushes created only when needed
Minimal allocations
Efficient equality checks
No reflection in hot paths
Getting Started
Basic Usage
Creating Gradients
The Bottom Line
WinForms doesn't have to look dated.
KtBrush brings modern UI capabilities to the platform you already know, without forcing you to rewrite your application in WPF, Avalonia, or Electron.
Stop fighting your UI framework. Start shipping beautiful applications.
Built with โค๏ธ for the Legacy WinForms community
Last updated
Was this helpful?