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

Gets or sets the margin used around child controls when AutoScroll is enabled.

Syntax

Visual Basic (Declaration) 
Public Property AutoScrollMargin As Size
C# 
public Size AutoScrollMargin {get; set;}

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 );

See Also