Infragistics(R) NetAdvantage(R) Windows Forms
AutoScroll Property
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.Misc Namespace > UltraPanel Class : AutoScroll Property

Gets or sets the value which indicates whether scroll bars should appear when child controls go outside the visible bounds of the control.

Syntax

Visual Basic (Declaration) 
Public Property AutoScroll As Boolean
C# 
public bool AutoScroll {get; set;}

Property Value

True to automatically show scroll bars; False otherwise.

Example

The following code demonstartes how to control the automatic scrolling capability of the UltraPanel.

Visual BasicCopy Code
Imports System.Windows.Forms
Imports Infragistics.Win

' Allow the UltraPanel to automatically show scroll bars based on its contents.
Me.UltraPanel1.AutoScroll = True

' Set the size of the UltraPanel
Me.UltraPanel1.Size = New Size(300, 300)

' Set the auto scroll margin so that 20 pixels of space are between the right 
' and bottom edges of the child controls and the edges of the area the user can 
' scroll to.
Me.UltraPanel1.AutoScrollMargin = New Size(20, 20)

' If no child control exists or they are not positioned far enough, make sure
' the scrollable area of the UltraPanel is at least 100 pixels wide and 500 tall.
Me.UltraPanel1.AutoScrollMinSize = New Size(100, 500)

' Add a .Net Button control to the UltraPanel which extends to 350 pixels in the 
' X and Y directions, which will cause the UltraPanel to show both scroll bars.
Dim button As New Button()
button.Location = New Point(250, 250)
button.Size = New Size(100, 100)
Me.UltraPanel1.ClientArea.Controls.Add(Button)
C#Copy Code
using System.Windows.Forms;
using Infragistics.Win;

// Allow the UltraPanel to automatically show scroll bars based on its contents.
this.ultraPanel1.AutoScroll = true;

// Set the size of the UltraPanel
this.ultraPanel1.Size = new Size( 300, 300 );

// Set the auto scroll margin so that 20 pixels of space are between the right 
// and bottom edges of the child controls and the edges of the area the user can 
// scroll to.
this.ultraPanel1.AutoScrollMargin = new Size( 20, 20 );

// If no child control exists or they are not positioned far enough, make sure
// the scrollable area of the UltraPanel is at least 100 pixels wide and 500 tall.
this.ultraPanel1.AutoScrollMinSize = new Size( 100, 500 );

// Add a .Net Button control to the UltraPanel which extends to 350 pixels in the 
// X and Y directions, which will cause the UltraPanel to show both scroll bars.
Button button = new Button();
button.Location = new Point( 250, 250 );
button.Size = new Size( 100, 100 );
this.ultraPanel1.ClientArea.Controls.Add( button );

Remarks

When this value is False, the scroll bars can be manually managed by setting values on the HorizontalScrollProperties and VerticalScrollProperties.

See Also