Border Design and Styling

This feature allows developers to customize the appearance of the control’s border, including its colors, gradient angle, thickness, and advanced styling options.

Overview

The Border Design and Styling feature enables detailed customization of the SiticoneContainer's border. Developers can set the border colors using a gradient effect, adjust the thickness, and choose from various extended styles such as dashed, dotted, or custom dash patterns. This flexibility provides a way to match the control’s border with the overall UI theme.


Key Points

Property
Description
Default Value

BorderColor1

Primary color used at the start of the border gradient.

Black

BorderColor2

Secondary color used to complete the border gradient.

Black

BorderAngle

The angle (in degrees) at which the border gradient is applied.

45f

BorderWidth

Thickness of the border in pixels.

2f

ShowBorder

Determines whether the border is drawn.

True

EnableCustomBorderStyle

Enables the use of custom border styles, allowing more advanced visual designs.

False

BorderStyleEx

Extended border style which can be set to values like Solid, Dashed, Dotted, DashDot, DashDotDot, etc.

Solid

CustomDashPattern

An array of floats that specifies a custom dash pattern when advanced border styles are enabled.

null


Best Practices

Practice
Description

Use contrasting border colors

Choose border colors that complement the background and ensure the border is clearly visible.

Maintain consistent thickness

Keep the border width consistent across controls to ensure a uniform look, especially when using a gradient effect.

Enable advanced styles only when needed

Only enable custom border styles (via EnableCustomBorderStyle) when the design requires non-standard border patterns.

Test custom dash patterns

If using a custom dash pattern, thoroughly test across different screen resolutions to verify visual consistency.


Common Pitfalls

Pitfall
Description
Recommendation

Overusing advanced styles

Enabling custom border styles without a clear design requirement can lead to an overly complex UI.

Stick to simpler styles unless a design overhaul is needed.

Inconsistent angle settings

Setting border angles that conflict with other gradient settings may lead to a disjointed look.

Ensure that the border angle aligns with overall theme gradients.

Neglecting the ShowBorder property

Failing to check the ShowBorder property may result in unexpected border rendering or conflicts with other effects.

Verify ShowBorder is set correctly when styling borders.


Usage Scenarios

Scenario
Description
Example Use Case

Standard Themed Panels

Applying a gradient border to panels that follow a standard theme across the application.

Use consistent border colors and widths on dashboard panels.

Emphasizing Active Controls

Highlighting a control by adjusting the border thickness and color when it is active or focused.

Change the border to a thicker, contrasting gradient when a panel is selected.

Custom UI Designs

Using advanced styles and custom dash patterns to create unique UI components for specialized applications.

Implement a dotted or dash-dot border on a notification card.


Code Examples

Example 1: Basic Border Customization

This example demonstrates setting up a SiticoneContainer control with a basic gradient border.

using System;
using System.Drawing;
using System.Windows.Forms;
using SiticoneNetFrameworkUI; // Ensure you reference the correct namespace

public class MainForm : Form
{
    public MainForm()
    {
        // Create an instance of the SiticoneContainer control
        SiticoneContainer container = new SiticoneContainer
        {
            Size = new Size(300, 200),
            Location = new Point(10, 10),
            // Set gradient border colors
            BorderColor1 = Color.DarkBlue,
            BorderColor2 = Color.LightBlue,
            // Define the angle and thickness for the border gradient
            BorderAngle = 60f,
            BorderWidth = 3f,
            ShowBorder = true
        };

        // Add the container to the form
        this.Controls.Add(container);
    }

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

Example 2: Using Advanced Border Styles

This example shows how to enable custom border styles and set a dashed border with a custom dash pattern.

using System;
using System.Drawing;
using System.Windows.Forms;
using SiticoneNetFrameworkUI; // Ensure you reference the correct namespace

public class MainForm : Form
{
    public MainForm()
    {
        // Create an instance of the SiticoneContainer control
        SiticoneContainer container = new SiticoneContainer
        {
            Size = new Size(300, 200),
            Location = new Point(20, 20),
            // Set gradient border colors
            BorderColor1 = Color.Maroon,
            BorderColor2 = Color.Orange,
            // Set the angle and thickness for the border gradient
            BorderAngle = 30f,
            BorderWidth = 4f,
            // Enable custom border styling for advanced options
            EnableCustomBorderStyle = true,
            BorderStyleEx = CustomBorderStyle.Dashed,
            // Optionally set a custom dash pattern if needed
            CustomDashPattern = new float[] { 4f, 2f, 1f, 2f }
        };

        // Add the container to the form
        this.Controls.Add(container);
    }

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

Review

Aspect
Notes

Flexibility

Provides both basic and advanced options to match various design requirements.

Ease of Integration

Simple properties and straightforward code examples allow quick customization through both code and the designer.

Visual Consistency

Using gradient colors and consistent border thickness can help create a unified appearance across the application.


Summary

The Border Design and Styling feature of the SiticoneContainer control allows developers to create visually appealing borders with gradient effects, adjustable thickness, and advanced styling options. By utilizing properties such as BorderColor1, BorderColor2, BorderAngle, and BorderWidth, along with enabling custom border styles, developers can tailor the control’s border to fit any design requirement.


Additional Tips

Tip
Explanation

Leverage the Visual Studio Designer

Use the property grid in the designer to experiment with different border settings and immediately see the results.

Combine with Other Effects

Integrate border styling with shadow and gradient background features to achieve a holistic and modern UI design.

Document Customizations

Maintain clear documentation of any custom border styles used so that future maintenance or updates remain consistent.

This comprehensive documentation should assist developers in effectively implementing and customizing the Border Design and Styling feature of the SiticoneContainer control within their .NET WinForms applications.

Last updated