Export (0) Print
Expand All

How to: Create a ScrollBar

.NET Framework 3.0

This example shows how to create a ScrollBar.

Example

The following example creates a horizontal ScrollBar.

hscrollb = new ScrollBar();
hscrollb.Orientation = Orientation.Horizontal;
spanel2.Children.Add(hscrollb);

The following example creates a vertical ScrollBar.

vscrollb = new ScrollBar();
vscrollb.Orientation = Orientation.Vertical;
vscrollb.HorizontalAlignment = HorizontalAlignment.Left;
vscrollb.Width = (20);
vscrollb.Height = (80);
Canvas.SetLeft(vscrollb, (50));
spanel2.Children.Add(vscrollb);

For the complete sample, which shows how to create several controls and includes a horizontal and vertical ScrollBar, see Creating Controls Sample.

See Also

Reference

ScrollBar

Community Additions

ADD
Show:
© 2015 Microsoft