Shape Customization

Allows developers to fine-tune the button's corner radii for a personalized, rounded or sharp-edged appearance.

Overview

The Shape Customization feature in the Siticone PlayPauseButton control gives developers granular control over the curvature of each corner of the button. By modifying the corner radius properties (top-left, top-right, bottom-left, and bottom-right), you can create a design ranging from fully rounded to completely sharp-cornered, ensuring that the control's shape integrates seamlessly with your application's overall visual language.


Feature Details

The table below summarizes the key properties associated with the Shape Customization feature:

Property
Type
Default Value
Description

TopLeftRadius

int

23

Defines the radius of the top-left corner in pixels; set to 0 for a sharp corner.

TopRightRadius

int

23

Defines the radius of the top-right corner in pixels; set to 0 for a sharp corner.

BottomLeftRadius

int

23

Defines the radius of the bottom-left corner in pixels; set to 0 for a sharp corner.

BottomRightRadius

int

23

Defines the radius of the bottom-right corner in pixels; set to 0 for a sharp corner.

Note: The corner radius values are only applied when the AutoMakeRadial setting is not active, ensuring that manual customization is respected.


Code Examples

Basic Integration

This example demonstrates how to adjust the corner radii of the SiticonePlayPauseButton control to create a fully rounded button:

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

namespace ShapeCustomizationDemo
{
    public partial class MainForm : Form
    {
        private SiticonePlayPauseButton playPauseButton;

        public MainForm()
        {
            InitializeComponent();
            InitializeShapeCustomizationDemo();
        }

        private void InitializeShapeCustomizationDemo()
        {
            playPauseButton = new SiticonePlayPauseButton
            {
                Location = new Point(50, 50),
                Size = new Size(100, 100),
                // Set all corners to be fully rounded
                TopLeftRadius = 50,
                TopRightRadius = 50,
                BottomLeftRadius = 50,
                BottomRightRadius = 50
            };

            this.Controls.Add(playPauseButton);
        }
    }
}

Advanced Customization

In this advanced example, the corner radii are modified dynamically at runtime using buttons to simulate a design editor that lets users choose between rounded and sharp corners:

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

namespace AdvancedShapeCustomizationDemo
{
    public partial class CustomizationForm : Form
    {
        private SiticonePlayPauseButton playPauseButton;
        private Button setRoundedButton;
        private Button setSharpButton;

        public CustomizationForm()
        {
            InitializeComponent();
            InitializeAdvancedShapeCustomization();
        }

        private void InitializeAdvancedShapeCustomization()
        {
            playPauseButton = new SiticonePlayPauseButton
            {
                Location = new Point(70, 30),
                Size = new Size(120, 120),
                // Initial shape: moderately rounded corners
                TopLeftRadius = 20,
                TopRightRadius = 20,
                BottomLeftRadius = 20,
                BottomRightRadius = 20
            };

            setRoundedButton = new Button
            {
                Text = "Rounded",
                Location = new Point(70, 170),
                Size = new Size(100, 30)
            };
            setRoundedButton.Click += (s, e) =>
            {
                // Apply full rounding
                playPauseButton.TopLeftRadius = 50;
                playPauseButton.TopRightRadius = 50;
                playPauseButton.BottomLeftRadius = 50;
                playPauseButton.BottomRightRadius = 50;
                playPauseButton.Invalidate();
            };

            setSharpButton = new Button
            {
                Text = "Sharp",
                Location = new Point(180, 170),
                Size = new Size(100, 30)
            };
            setSharpButton.Click += (s, e) =>
            {
                // Apply sharp corners
                playPauseButton.TopLeftRadius = 0;
                playPauseButton.TopRightRadius = 0;
                playPauseButton.BottomLeftRadius = 0;
                playPauseButton.BottomRightRadius = 0;
                playPauseButton.Invalidate();
            };

            this.Controls.Add(playPauseButton);
            this.Controls.Add(setRoundedButton);
            this.Controls.Add(setSharpButton);
        }
    }
}

Key Points

Aspect
Details

Corner Customization

Developers can set each corner individually, allowing for non-uniform designs if desired.

Dynamic Updates

Any change to a corner radius automatically triggers a redraw via the Invalidate() call, ensuring real-time updates.

Default Behavior

The default value of 23 pixels provides a moderately rounded look, which can be adjusted based on design needs.


Best Practices

Recommendation
Rationale

Maintain consistency

Ensure that the corner radii complement the overall UI design for a cohesive look.

Use dynamic updates sparingly

Avoid rapid, frequent changes to corner radii during runtime unless it is part of a specific design feature.

Test on different control sizes

Verify that the shape customization scales correctly across various button dimensions.


Common Pitfalls

Issue
Explanation
Prevention/Remedy

Mismatched corner radii

Setting vastly different radii for each corner might lead to an unbalanced or unexpected design.

Plan your design and test the visual balance before finalizing the settings.

Over-customization

Excessive variation in corner radii can reduce the overall visual harmony of the application.

Use subtle changes that align with your application's theme.

Ignoring the Invalidate() call

Failing to refresh the control after updating radii may result in outdated visuals being displayed.

Rely on property setters that call Invalidate() or explicitly invoke it after updates.


Usage Scenarios

Scenario
Description
Sample Code Reference

Custom Themed Applications

Adjust the button's shape to align with custom design elements or brand guidelines.

Refer to the Basic Integration sample.

Dynamic User Interfaces

Provide users with options to change the UI dynamically, such as toggling between rounded and sharp corners.

Refer to the Advanced Customization sample.

Prototyping and Design Iteration

Quickly experiment with different corner radii to find the optimal visual appearance during design iterations.

Use the Advanced Customization demo as a starting point.


Review

When reviewing the Shape Customization implementation, consider the following checklist:

Checklist Item
Recommendation

Consistent Appearance

Verify that the rounded or sharp corners align with the overall design and branding guidelines.

Dynamic Responsiveness

Ensure that runtime updates to corner radii are smoothly rendered without visual glitches.

Scalability

Confirm that the control's shape scales appropriately across different sizes and resolutions.

User Feedback

Consider gathering user feedback if the shape customization is exposed as a configurable option in the UI.


Summary

The Shape Customization feature in the SiticonePlayPauseButton control provides the flexibility to design buttons with precisely tailored corner curvatures. By setting individual radii for the top-left, top-right, bottom-left, and bottom-right corners, developers can create a wide range of button shapes—from fully rounded to completely sharp-edged—ensuring that the control integrates perfectly into any UI design. Proper implementation of this feature enhances both the aesthetic appeal and the usability of the control.


Additional Sections

Integration Tips

Tip
Explanation

Experiment with different radius values

Test various combinations of corner radii to achieve a balanced design that complements your UI elements.

Use design tools for preview

Leverage design prototyping tools to preview how different corner radii will appear before coding them.

Consider control scaling

Ensure that the customized shape remains visually appealing across multiple sizes by testing on various form factors.

Demo Projects

To further demonstrate the Shape Customization feature, consider developing demo applications such as:

Demo Feature
Description

Interactive UI Designer

A demo where users can interactively adjust each corner radius in real-time to see the impact on the control's shape.

Themed Button Showcase

A collection of buttons with different shape customizations that match various design themes, demonstrating versatility.

Prototyping Tool Integration

Integration with prototyping tools to allow designers to preview and tweak button shapes before deployment.

By following this comprehensive documentation, developers can effectively utilize the Shape Customization feature to create visually distinct and well-integrated buttons in their .NET WinForms applications.

Last updated