ComponentOne Slider for ASP.NET AJAX: Slider for ASP.NET AJAX Task-Based Help > Adding a Border to C1Slider

Adding a Border to C1Slider

You may want to add a border around the C1Slider control to increase the control's accessibility. A border allows the slider's track to be more easily distinguished when viewed in high contrast mode. The border's appearance can be set in Source view, Design view, and code using the control's BorderColor, BorderStyle, and BorderWidth properties. In the following example you'll add a thin, black line around the C1Slider control.

In Source View

In Source view set the control's BorderColor, BorderStyle, and BorderWidth properties by adding text to the <cc1:C1Slider> tag so it appears similar to the following:

<cc1:C1Slider ID="C1Slider1" runat="server" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />

In Design View

Complete the following to set the control's BorderColor, BorderStyle, and BorderWidth properties in the Properties window:

1.   Click on the C1Slider control to select it.

2.   Navigate to the Properties window and, if needed, expand the Appearance node.

3.   Set the following properties:

      Set the BorderColor property to Black.

      Set the BorderStyle property to Solid.

      Set the BorderWidth property to 1.

In Code

Complete the following to set the control's BorderColor, BorderStyle, and BorderWidth properties in code:

1.   Add the following imports/using statements to your project:

      Visual Basic

Imports System.Web.UI.WebControls

Imports System.Drawing

Imports C1.Web.UI.Controls.C1Slider

      C#

using System.Web.UI.WebControls;

using System.Drawing;

using C1.Web.UI.Controls.C1Slider;

2.   Add the following code to the Page_Load event to set thecontrol's BorderColor, BorderStyle, and BorderWidth properties:

      Visual Basic

Me.C1Slider1.BorderColor = Color.Black

Me.C1Slider1.BorderStyle = BorderStyle.Solid

Me.C1Slider1.BorderWidth = 1

      C#

this.C1Slider1.BorderColor = Color.Black;

this.C1Slider1.BorderStyle = BorderStyle.Solid;

this.C1Slider1.BorderWidth = 1;

Run your project and observe:

The C1Slider control will appear with a solid, black, 1 pixel border:

 


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.