Corner Radius Settings

A feature that enables developers to customize the curvature of the progress bar's corners for a refined and modern UI appearance.

Overview

The Corner Radius Settings feature in the SiticoneVLineProgress control provides control over the roundedness of each corner, allowing for a tailored look that matches your application's design aesthetic. With individual settings for the top-left, top-right, bottom-right, and bottom-left corners—as well as an option to synchronize them—this feature gives developers precise control over the control's overall shape.


Key Points

Property/Method
Description
Default Value

TopLeftRadius

Sets the radius for the top-left corner of the control.

0 (default)

TopRightRadius

Sets the radius for the top-right corner of the control.

0 (default)

BottomRightRadius

Sets the radius for the bottom-right corner of the control.

0 (default)

BottomLeftRadius

Sets the radius for the bottom-left corner of the control.

0 (default)

SyncCornerRadius

When enabled, changing one corner's radius synchronizes all corners to the same value.

false (default)

SetCornerRadii(...)

A helper method that sets all four corner radii in one call, allowing for individual customization when sync is disabled.

N/A


Best Practices

Practice
Description
Example Scenario

Use synchronization for uniform designs

Enable SyncCornerRadius if a consistent, rounded look is desired across all corners.

A modern UI where all buttons and controls share uniform curvature.

Customize individual corners for unique shapes

Disable synchronization when different corner radii are needed to create custom shapes or emphasize certain edges.

Creating a progress bar with a single rounded corner for a unique design.

Test various radius values

Experiment with different radius settings to achieve the right balance between subtlety and visual appeal.

Adjusting radii for both small and large control sizes to maintain legibility and design consistency.


Common Pitfalls

Pitfall
Description
How to Avoid

Over-synchronization

Enabling SyncCornerRadius when individual corner customizations are needed can limit design flexibility.

Disable SyncCornerRadius if unique radii for different corners are required.

Excessively large radius values

Setting the radius too high might cause visual artifacts or an unprofessional appearance.

Use radius values that are proportional to the control's dimensions.

Neglecting to refresh the control after updates

Changes to corner radii may not reflect until the control is invalidated or refreshed.

Always call Invalidate() after modifying the radius settings if needed.


Usage Scenarios

Scenario
Description
Code Sample Reference

Uniform rounded corners

Use SyncCornerRadius to quickly apply the same radius to all corners for a clean and modern look.

Example 1 below.

Custom corner design

Set individual corner radii to create a distinctive visual effect on the progress bar.

Example 2 below.

Dynamic design adjustments

Change corner radii at runtime based on user interaction or theme changes.

Example 3 below.


Code Examples

Example 1: Uniform Rounded Corners

This example demonstrates enabling SyncCornerRadius to apply the same radius to all corners.

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

namespace MyWinFormsApp
{
    public partial class UniformCornerForm : Form
    {
        private SiticoneVLineProgress progressBar;

        public UniformCornerForm()
        {
            InitializeComponent();
            InitializeProgressBar();
        }

        private void InitializeProgressBar()
        {
            progressBar = new SiticoneVLineProgress
            {
                // Set a uniform corner radius for a smooth, rounded appearance
                TopLeftRadius = 10,
                SyncCornerRadius = true,
                Minimum = 0,
                Maximum = 100,
                Value = 50,
                Location = new Point(30, 30),
                Size = new Size(16, 240)
            };

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

Example 2: Custom Individual Corners

This example shows how to disable SyncCornerRadius and set different radii for each corner.

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

namespace MyWinFormsApp
{
    public partial class CustomCornerForm : Form
    {
        private SiticoneVLineProgress progressBar;

        public CustomCornerForm()
        {
            InitializeComponent();
            InitializeProgressBar();
        }

        private void InitializeProgressBar()
        {
            progressBar = new SiticoneVLineProgress
            {
                // Disable synchronization to allow for custom radii per corner
                SyncCornerRadius = false,
                TopLeftRadius = 5,
                TopRightRadius = 15,
                BottomRightRadius = 25,
                BottomLeftRadius = 10,
                Minimum = 0,
                Maximum = 100,
                Value = 30,
                Location = new Point(50, 50),
                Size = new Size(16, 240)
            };

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

Example 3: Dynamic Corner Radius Adjustment

This example demonstrates using the SetCornerRadii method to update all corner radii dynamically during runtime.

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

namespace MyWinFormsApp
{
    public partial class DynamicCornerForm : Form
    {
        private SiticoneVLineProgress progressBar;

        public DynamicCornerForm()
        {
            InitializeComponent();
            InitializeProgressBar();
        }

        private void InitializeProgressBar()
        {
            progressBar = new SiticoneVLineProgress
            {
                SyncCornerRadius = false, // Initially allow individual control
                TopLeftRadius = 8,
                TopRightRadius = 8,
                BottomRightRadius = 8,
                BottomLeftRadius = 8,
                Minimum = 0,
                Maximum = 100,
                Value = 40,
                Location = new Point(70, 70),
                Size = new Size(16, 240)
            };

            this.Controls.Add(progressBar);
        }

        private void UpdateCornerRadii(float newRadius)
        {
            // Use the helper method to set all corners to the same radius
            progressBar.SetCornerRadii(newRadius, newRadius, newRadius, newRadius);
            // Optionally, enable synchronization after update for consistency
            progressBar.SyncCornerRadius = true;
            progressBar.Invalidate(); // Refresh the control to apply the changes
        }
    }
}

Review

Aspect
Notes

Design Flexibility

Provides detailed control over each corner, enabling both uniform and customized designs to suit various UI themes.

Ease of Implementation

The properties are intuitive to set, and the helper method simplifies the process of updating all corner radii simultaneously.

Dynamic Customization

Allows runtime adjustments, which is useful for adaptive designs and responsive interfaces.


Summary

The Corner Radius (Rounded Corners) Settings feature in the SiticoneVLineProgress control offers developers the flexibility to create visually appealing, modern UI elements. By adjusting properties like TopLeftRadius, TopRightRadius, BottomRightRadius, BottomLeftRadius, and enabling SyncCornerRadius, you can ensure that the control's shape aligns with your design vision. Comprehensive code examples demonstrate uniform, customized, and dynamic implementations, making it easy to integrate this feature into any .NET WinForms application.


Additional Sections

Troubleshooting

Issue
Possible Cause
Resolution

Rounded corners not appearing as expected

Radius values set too high or sync settings overriding custom values.

Adjust the values proportionally to the control size and disable SyncCornerRadius if necessary.

Control not refreshing after changes

Updated properties not triggering a redraw.

Call Invalidate() to refresh the control after modifying radius properties.

Inconsistent appearance across different resolutions

Device-specific scaling issues.

Test on multiple devices and adjust radius values accordingly.

Integration Checklist

Checklist Item
Details

Set initial corner radii

Define initial values for TopLeftRadius, TopRightRadius, BottomRightRadius, and BottomLeftRadius appropriately.

Decide on synchronization

Determine whether uniformity (SyncCornerRadius) is desired or if individual customization is needed.

Validate runtime updates

Confirm that dynamic changes to corner radii are applied and rendered as expected.

Additional Recommendations

Recommendation
Description

Balance aesthetics and functionality

Ensure that the chosen corner radii enhance visual appeal without compromising the usability of the control.

Document any custom behaviors

Maintain documentation for any runtime changes to corner settings for future reference and troubleshooting.

Optimize for various screen resolutions

Test and fine-tune corner radii on different devices to maintain a consistent look and feel.


By following this comprehensive documentation for the Corner Radius (Rounded Corners) Settings feature, developers can effectively integrate and customize the shape of the SiticoneVLineProgress control, thereby enhancing the visual sophistication and user experience of their .NET WinForms applications.

Last updated