๐น Kt-Window
KtWindow is a modern, feature-rich window/form component for WinForms that brings beautiful dark mode support, gradient backgrounds, and flicker-free rendering to your applications. Built with native Windows API optimizations for professional, smooth user experiences.
๐ Cool Features
โจ Automatic Dark Mode
Native Windows 10/11 title bar dark mode that automatically matches your theme.
public partial class MyWindow : KtWindow
{
public MyWindow()
{
InitializeComponent();
// Dark mode automatically applied based on KtColor.IsDark()
}
}How it works:
Automatically detects system theme or your custom theme
Updates title bar to match (dark or light)
No flickering during theme transitions
Native Windows 10/11 immersive dark mode API
๐จ Gradient Backgrounds
Beautiful gradient backgrounds with zero code complexity.
Features:
Smooth gradients with any two colors
Adjustable angle for direction
Automatic theme updates
Flicker-free rendering
๐ Zero Flicker Rendering
Optimized with native Windows API for butter-smooth rendering.
What makes it flicker-free:
Native
WS_EX_COMPOSITEDstyle for hardware accelerationDouble buffering enabled by default
Optimized paint events
Smart invalidation (only redraws what changed)
๐ Auto Theme Synchronization
Automatically updates when theme changes - no manual refresh needed!
Automatic updates when:
User switches between dark/light mode
Theme colors change
System theme changes
๐ช Drop Shadow Support
Beautiful drop shadow for borderless windows.
๐ฏ Smart Window Management
Intelligent features that just work.
Creating a KtWindow
Step 1: Inherit from KtWindow
Step 2: Set Background (Optional)
Step 3: Set Foreground (Optional)
That's it! You now have a modern window with dark mode support.
Properties
Background
Sets the window background (solid color or gradient).
Examples:
Foreground
Sets the window foreground color (text and UI elements).
Examples:
Text (Title)
Gets or sets the window title.
Examples:
IsDark / IsLight (Read-Only)
Detects current theme mode.
Examples:
Background & Foreground
Setting Background Colors
Solid Colors:
Gradient Colors:
Setting Foreground Colors
Dark Mode
Automatic Dark Mode
KtWindow automatically applies native dark mode to the title bar.
How it detects dark mode:
Checks
KtColor.IsDark()- your theme settingApplies Windows 10/11 immersive dark mode API
Updates title bar color automatically
Syncs with theme changes
Manual Dark Mode Control
Borderless Window Shadow
For modern borderless windows, KtWindow automatically adds a drop shadow:
Methods
Render()
Manually trigger a full window render.
When to use:
After changing multiple properties
After manual theme changes
To force visual update
Example:
What it does:
Updates ForeColor from Foreground
Updates BackColor from Background
Triggers RenderMode() for dark mode
Invalidates and updates display
RenderMode()
Updates the window's dark/light mode.
Example:
What it does:
Applies native Windows immersive dark mode
Updates title bar appearance
Adds shadow for borderless windows
Sets composited style for flicker-free rendering
Title()
Get or set the window title.
Examples:
GetForeground()
Gets the effective foreground color.
Example:
Use case:
When you need the actual foreground color
For child controls that inherit color
For custom painting
Snapshot()
Captures the window as an image.
Example:
Mirror()
Captures the screen area behind the window.
Example:
Use case:
Creating blur effects
Transparency effects
Acrylic/glass effects
Reset Methods
Advanced Features
Theme Change Events
KtWindow automatically subscribes to theme changes.
Manual subscription (if needed):
Property Change Notifications
KtWindow implements INotifyPropertyChanged.
Example:
Custom Paint Background
Override for custom background rendering.
Native API Optimizations
KtWindow uses several Windows APIs for optimal performance:
1. DWM (Desktop Window Manager) APIs:
2. Window Styles:
3. Message Handling:
Best Practices
โ
DO: Use Theme Colors
โ
DO: Use Gradients for Visual Impact
โ
DO: Let Automatic Updates Handle Theme Changes
โ DON'T: Call Render() Excessively
โ DON'T: Set Opacity in Designer
โ
DO: Use Title() Method
Complete Examples
Example 1: Basic Modern Window
Example 2: Borderless Window with Shadow
Example 3: Dynamic Theme-Aware Window
Example 4: Window with Progress Title
Summary
KtWindow provides a complete modern window solution with:
โ Automatic Dark Mode - Native Windows 10/11 title bar theming
โ Gradient Backgrounds - Beautiful, smooth gradients with any angle
โ Zero Flicker - Native API optimizations for smooth rendering
โ Auto Theme Sync - Updates automatically when theme changes
โ Drop Shadows - Beautiful shadows for borderless windows
โ Smart Management - Title updates, snapshots, and more
โ Easy to Use - Just inherit from KtWindow and go!
For more information about KtColor, KtBrush, and other KimTools components, refer to their respective documentation.
Last updated
Was this helpful?