๐น Kt-CheckButton
Overview
KtCheckButton is a modern, customizable toggle button control that combines the functionality of a checkbox with the visual appearance of a button. It provides rich styling options including gradients, icons, and smooth state transitions, making it ideal for creating engaging user interfaces in Windows Forms applications.
Key Properties
Checked
bool
false
Gets or sets whether the button is in checked/toggled state
Text
string
""
The text displayed on the button
Icon
string
""
Icon identifier for unchecked state
Icon_Checked
string
"tabler.solid.circle_check_filled"
Icon identifier for checked state
Background
KtBrush
Gradient
Background brush for unchecked state
Background_Checked
KtBrush
Solid
Background brush for checked state
Border
KtBrush
Gradient
Border brush for unchecked state
Border_Checked
KtBrush
Solid
Border brush for checked state
BorderRadius
float
10
Roundness of button corners
BorderWidth
float
2
Thickness of the border
Foreground
KtColor
Empty
Text/icon color for unchecked state
Foreground_Checked
KtColor
Empty
Text/icon color for checked state
IconSize
int
16
Size of the icon in pixels
IconStroke
double
2.5
Stroke width for icon rendering
TextAlign
ContentAlignment
MiddleCenter
Alignment of text within button
ImageAlign
ContentAlignment
MiddleLeft
Alignment of icon within button
TextMargin
int
0
Spacing between text and icon
Padding
Padding
7,7,7,7
Internal padding of button content
Events
CheckedChanged
Fires when the Checked property changes
Basic Usage
Simple Toggle Button
Button with Icon
Styling Examples
Gradient Background
Solid Color with Custom Border
Minimalist Style
Advanced Features
Custom Icon Colors
Text and Icon Alignment
Programmatic Control
Common Patterns
Toggle Group (Radio-like Behavior)
State Indicator
Animated Theme Toggle
Design Tips
Consistency: Use the same
BorderRadiusacross related buttons for visual cohesionIcon Selection: Choose icons that clearly represent both states (e.g., play/pause, on/off)
Color Contrast: Ensure checked and unchecked states are visually distinct
Hover Effects: The control automatically provides hover feedback
Accessibility: The button defaults to a hand cursor to indicate interactivity
Performance Notes
Use
SuspendLayout()andResumeLayout()when making multiple property changesThe
Render()method is automatically called on property changesIcon rendering is cached for performance
Related Controls
KtCheckBox: Traditional checkbox with advanced styling
Last updated
Was this helpful?