Siticone Maximize Button
The SiticoneMaximizeButton is a smart window management control that toggles a Form between Maximized and Normal states.
It automatically detects its parent form, adjusts its icon (Maximize square vs. Restore double-squares), and provides high-performance animations and visual feedback.
Appearance & Styling
Properties to customize the look of the maximize/restore icon and its container.
| Property | Type | Description & Usage Example |
|---|---|---|
IconColor |
Color | maxBtn.IconColor = Color.DimGray; The color of the icon in its default state. |
IconHoverColor |
Color | maxBtn.IconHoverColor = Color.FromArgb(0, 120, 215); The color of the icon when the mouse hovers over the button. |
IconSize |
int | maxBtn.IconSize = 12; Size of the icon geometry in pixels. |
IconThickness |
int | maxBtn.IconThickness = 2; Thickness of the icon lines. |
EnableBorder |
bool | maxBtn.EnableBorder = false; Toggles the visibility of the button's outer border. |
BorderColor |
Color |
maxBtn.BorderColor = Color.LightGray;
The color of the border when EnableBorder is true.
|
BorderHoverColor |
Color | maxBtn.BorderHoverColor = Color.Blue; The color of the border when hovered. |
Behavior & Interaction
Controls how the button responds to user input and its functional mode.
| Property | Type | Description & Usage Example |
|---|---|---|
IsReadOnly |
bool | maxBtn.IsReadOnly = true; If true, clicking the button does NOT toggle the window state. Triggers Shake/Beep feedback instead. |
ReadonlyIconColor |
Color |
maxBtn.ReadonlyIconColor = Color.LightGray;
The icon color when IsReadOnly is true.
|
CanShake |
bool | maxBtn.CanShake = true; If true, the parent form shakes when clicked in ReadOnly mode. |
CanBeep |
bool | maxBtn.CanBeep = true; If true, plays a system sound when clicked in ReadOnly mode. |
Animations
Settings for the smooth visual transitions.
| Property | Type | Description & Usage Example |
|---|---|---|
AnimationSpeed |
int | maxBtn.AnimationSpeed = 150; Duration of the hover color transition (in milliseconds). |
EnablePressAnimation |
bool | maxBtn.EnablePressAnimation = true; Enables the scale-down effect when the button is pressed. |
PressScaleAmount |
float | maxBtn.PressScaleAmount = 0.9f; The scale factor (0.0 to 1.0) when pressed. |
PressAnimationSpeed |
int | maxBtn.PressAnimationSpeed = 100; Duration of the press/release animation (in milliseconds). |
Events
Hooks to intervene in the window state change process.
// Fired after the window state has successfully toggled.
maxBtn.StateChanged += (sender, e) =>
{
if (e.NewState == FormWindowState.Maximized)
Console.WriteLine("Window Maximized");
else
Console.WriteLine("Window Restored");
};
// Fired just before the action occurs. Can be cancelled.
maxBtn.BeforeMaximize += (sender, e) =>
{
if (currentMode == "FixedSize")
{
e.Cancel = true;
MessageBox.Show("Maximizing is disabled in this mode.");
}
};
// Fired when clicked while IsReadOnly is true.
maxBtn.ReadonlyInteraction += (sender, e) =>
{
ToolTip.Show("Window size is locked.", maxBtn, 0, -20, 2000);
};
Designer Support
The control includes a Smart Tag panel for rapid configuration.
| Category | Features |
|---|---|
Theme Presets |
Instantly apply visual styles:
|
Utilities |
Copy/Paste Settings: Duplicate styles across buttons. Invert Colors: Swaps hover and normal colors. Reset All: Reverts to default factory settings. |
Detailed Examples
Example 1: Conditional Maximization
Preventing maximization based on application logic.
public void ConfigureMaximizeButton()
{
// Prevent maximizing if user hasn't saved data
maxBtn.BeforeMaximize += (s, e) =>
{
if (_hasUnsavedChanges)
{
e.Cancel = true;
MessageBox.Show("Please save your work before maximizing.");
// Visual feedback
maxBtn.IconColor = Color.Red;
}
};
}
Example 2: Locked Window State
Using the ReadOnly features to create a "Fixed" window mode.
public void LockWindowSize()
{
maxBtn.IsReadOnly = true;
maxBtn.ReadonlyIconColor = Color.DarkGray;
// Provide haptic/audio feedback when user tries to click
maxBtn.CanShake = true;
maxBtn.CanBeep = true;
// Custom message
maxBtn.ReadonlyInteraction += (s, e) =>
{
statusLabel.Text = "Window size is currently locked.";
};
}