Freigeben über


ScrollableControl.ScrollControlIntoView-Methode

Führt einen Bildlauf durch, um das angegebene untergeordnete Steuerelement in einem Steuerelement anzuzeigen, für das der automatische Bildlauf aktiviert ist.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
Public Sub ScrollControlIntoView ( _
    activeControl As Control _
)
'Usage
Dim instance As ScrollableControl
Dim activeControl As Control

instance.ScrollControlIntoView(activeControl)
public void ScrollControlIntoView (
    Control activeControl
)
public:
void ScrollControlIntoView (
    Control^ activeControl
)
public void ScrollControlIntoView (
    Control activeControl
)
public function ScrollControlIntoView (
    activeControl : Control
)

Parameter

  • activeControl
    Das durch einen Bildlauf anzuzeigende untergeordnete Steuerelement.

Hinweise

Die AutoScroll-Eigenschaft muss auf true festgelegt sein, und außerdem muss mindestens eine Bildlaufleiste, die horizontale oder die vertikale, angezeigt werden, damit die ScrollControlIntoView-Methode sinnvoll verwendet werden kann. Zum Anzeigen der horizontalen und der vertikalen Bildlaufleiste muss die HScroll-Eigenschaft bzw. die VScroll-Eigenschaft auf true festgelegt werden.

Wenn der activeControl-Parameter kein untergeordnetes Steuerelement ist, erfolgt keine Aktion.

Diese Methode löst möglicherweise das Scroll-Ereignis aus.

Beispiel

Im folgenden Codebeispiel wird der automatische Bildlauf für ein Formular aktiviert, die Größe des Formulars geändert und gewährleistet, dass eine Schaltfläche weiterhin angezeigt wird, nachdem die Größe des Formulars geändert wurde. Für das Beispiel muss in einem Form der Buttonbutton2 vorhanden sein.

Private Sub ResizeForm()
   ' Enable auto-scrolling for the form.
   Me.AutoScroll = True
   
   ' Resize the form.
   Dim r As Rectangle = Me.ClientRectangle
   ' Subtract 100 pixels from each side of the Rectangle.
   r.Inflate(- 100, - 100)
   Me.Bounds = Me.RectangleToScreen(r)
   
   ' Make sure button2 is visible.
   Me.ScrollControlIntoView(button2)
End Sub
private void ResizeForm()
{
   // Enable auto-scrolling for the form.
   this.AutoScroll = true;

   // Resize the form.
   Rectangle r = this.ClientRectangle;
   // Subtract 100 pixels from each side of the Rectangle.
   r.Inflate(-100, -100);
   this.Bounds = this.RectangleToScreen(r);

   // Make sure button2 is visible.
   this.ScrollControlIntoView(button2);
}
private:
   void ResizeForm()
   {
      
      // Enable auto-scrolling for the form.
      this->AutoScroll = true;
      
      // Resize the form.
      Rectangle r = this->ClientRectangle;
      
      // Subtract 100 pixels from each side of the Rectangle.
      r.Inflate(  -100, -100 );
      this->Bounds = this->RectangleToScreen( r );
      
      // Make sure button2 is visible.
      this->ScrollControlIntoView( button2 );
   }
private void ResizeForm()
{
    // Enable auto-scrolling for the form.
    this.set_AutoScroll(true);
    // Resize the form.
    Rectangle r = this.get_ClientRectangle();
    // Subtract 100 pixels from each side of the Rectangle.
    r.Inflate(-100, -100);
    this.set_Bounds(this.RectangleToScreen(r));
    // Make sure button2 is visible.
    this.ScrollControlIntoView(button2);
} //ResizeForm

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

ScrollableControl-Klasse
ScrollableControl-Member
System.Windows.Forms-Namespace
AutoScroll
SetDisplayRectLocation
HScroll
VScroll
Scroll