Corner and Shape Config

This feature enables developers to adjust the curvature of the button’s corners to achieve a tailored, modern look—from subtle rounded edges to a fully circular (radial) shape.

Overview

The Corner Radius & Shape Customization feature provides a set of properties that allow developers to define individual corner radii and toggle a radial mode. This flexibility helps ensure that the button can conform to various design themes—from sharp-edged to pill-shaped or circular—depending on the application’s aesthetic and functional requirements.


Detailed Documentation

Properties & Settings

The table below outlines the customizable properties related to corner radii and shape:

Property
Description
Default Value
Type
Example Usage

TopLeftRadius

Sets the radius (in pixels) of the top-left corner; automatically limited based on control height.

19

int

copyButton.TopLeftRadius = 15;

TopRightRadius

Sets the radius (in pixels) of the top-right corner; automatically limited based on control height.

19

int

copyButton.TopRightRadius = 15;

BottomLeftRadius

Sets the radius (in pixels) of the bottom-left corner; automatically limited based on control height.

19

int

copyButton.BottomLeftRadius = 15;

BottomRightRadius

Sets the radius (in pixels) of the bottom-right corner; automatically limited based on control height.

19

int

copyButton.BottomRightRadius = 15;

MakeRadial

When enabled, this property adjusts all corner radii to create a circular or pill‑shaped button.

false

bool

copyButton.MakeRadial = true;


Code Examples and Integration Demos

Basic Integration Example

The following example demonstrates how to configure the individual corner radii for a standard copy button:

using System;
using System.Drawing;
using System.Windows.Forms;
using SiticoneNetFrameworkUI;

namespace CornerRadiusDemo
{
    public class MainForm : Form
    {
        private SiticoneCopyButton copyButton;
        private TextBox targetTextBox;

        public MainForm()
        {
            InitializeComponents();
        }

        private void InitializeComponents()
        {
            // Create and configure the target TextBox
            targetTextBox = new TextBox
            {
                Location = new Point(20, 20),
                Width = 250,
                Text = "Text to be copied."
            };

            // Create and configure the SiticoneCopyButton with custom corner radii
            copyButton = new SiticoneCopyButton
            {
                Location = new Point(20, 60),
                Size = new Size(200, 40),
                Text = "Copy",
                TargetControl = targetTextBox,
                TopLeftRadius = 10,
                TopRightRadius = 20,
                BottomLeftRadius = 10,
                BottomRightRadius = 20
            };

            // Add controls to the form
            Controls.Add(targetTextBox);
            Controls.Add(copyButton);
        }

        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new MainForm());
        }
    }
}

Advanced Customization Example

This example illustrates how to enable the radial mode so that the button automatically becomes circular or pill‑shaped based on its dimensions:

using System;
using System.Drawing;
using System.Windows.Forms;
using SiticoneNetFrameworkUI;

namespace RadialButtonDemo
{
    public class CustomForm : Form
    {
        private SiticoneCopyButton radialCopyButton;
        private TextBox demoTextBox;

        public CustomForm()
        {
            InitializeComponents();
        }

        private void InitializeComponents()
        {
            demoTextBox = new TextBox
            {
                Location = new Point(30, 30),
                Width = 300,
                Text = "Demo text for radial copy button."
            };

            // Enable radial shaping; the control will compute appropriate radii to form a circular/pill shape.
            radialCopyButton = new SiticoneCopyButton
            {
                Location = new Point(30, 80),
                Size = new Size(150, 50),
                Text = "Radial Copy",
                TargetControl = demoTextBox,
                MakeRadial = true
            };

            Controls.Add(demoTextBox);
            Controls.Add(radialCopyButton);
        }

        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new CustomForm());
        }
    }
}

Key Points

Aspect
Details

Individual Customization

Developers can set the radius for each corner separately to achieve non-uniform curvature.

Automatic Radial Mode

The MakeRadial property simplifies the process of creating a circular or pill‑shaped button.

Dynamic Limitations

Corner radius values are automatically limited based on the control's height to maintain visual integrity.


Best Practices

Practice
Recommendation

Consistent UI Styling

Ensure that the corner radii settings match the overall design language of the application.

Use Radial Mode Judiciously

Enable MakeRadial only when the button’s dimensions support a clean circular or pill‑shaped appearance.

Validate on Resize

Since the control adjusts corner radii on size changes, test behavior when the control is resized dynamically.


Common Pitfalls

Issue
Explanation
Avoidance Strategy

Oversized Radii

Setting a corner radius greater than half the control’s height might cause unexpected rendering.

Rely on the built‑in limitations or test with incremental adjustments.

Inconsistent Appearance with Manual Settings

Manually setting individual corner radii while also enabling MakeRadial can create conflicts.

Use one method consistently: either manual adjustments or MakeRadial.

Unexpected Changes on Resize

The control may update radii based on its new dimensions when resized.

Test the control under various window sizes to ensure stability.


Usage Scenarios

Scenario
Description
Sample Configuration

Standard Rounded Corners

For buttons that require subtle rounded edges to match a modern UI style.

Set TopLeftRadius, TopRightRadius, BottomLeftRadius, and BottomRightRadius to similar moderate values (e.g., 10–20).

Emphasized UI Elements

When a unique button design is desired, such as one with non-uniform corner radii.

Adjust individual corner properties to different values (e.g., TopLeft: 5, TopRight: 20, BottomLeft: 15, BottomRight: 20).

Circular/Pill-Shaped Buttons

When a completely rounded (or pill-shaped) button is needed for a specific design or mobile-style interface.

Enable MakeRadial (i.e., set MakeRadial = true) and adjust the control’s dimensions accordingly.


Review

Aspect
Considerations

Customization Flexibility

The feature provides granular control over each corner as well as an easy-to-use radial option.

Dynamic Adaptability

Automatic radius adjustments during resize events ensure that the button’s shape remains consistent and visually appealing.

Integration Ease

Code examples demonstrate straightforward integration into WinForms applications, allowing rapid styling changes.


Summary

Summary Point
Description

Tailored Corner Customization

The Corner Radius & Shape Customization feature offers both individual corner control and an automatic radial mode for versatile button styling.

Visual Consistency

By automatically limiting corner values based on control size, the feature ensures a balanced, aesthetically pleasing appearance.

Seamless Integration

With detailed properties and clear integration examples, developers can easily adapt the button's shape to suit diverse design requirements.


Additional Useful Sections

Integration Checklist

Item
Check

Set Corner Radii

Confirm that TopLeftRadius, TopRightRadius, BottomLeftRadius, and BottomRightRadius are set appropriately.

Test MakeRadial Functionality

Enable MakeRadial and verify that the button automatically forms a circular or pill‑shaped appearance.

Verify Resize Behavior

Ensure that the control adjusts the radii correctly when its size changes.

Troubleshooting

Problem
Potential Cause
Suggested Fix

Incorrect Curvature

Overriding MakeRadial with manual radius values can conflict with the automatic calculations.

Use either manual settings or MakeRadial consistently.

Visual Inconsistencies on Resize

Dynamic resizing might lead to unexpected rounding if not accounted for.

Test the control’s behavior in different window sizes and adjust accordingly.


By following this extensive documentation and using the provided code examples, developers can efficiently integrate and customize the Corner Radius & Shape Customization feature of the SiticoneCopyButton control. This ensures that buttons can be styled to match the precise visual design required for modern, responsive WinForms applications.

Last updated