ScrollableControl.ScrollControlIntoView(Control) Methode

Definitie

Schuift het opgegeven onderliggende besturingselement in beeld op een besturingselement waarvoor automatisch schuiven is ingeschakeld.

public:
 void ScrollControlIntoView(System::Windows::Forms::Control ^ activeControl);
public void ScrollControlIntoView(System.Windows.Forms.Control activeControl);
member this.ScrollControlIntoView : System.Windows.Forms.Control -> unit
Public Sub ScrollControlIntoView (activeControl As Control)

Parameters

activeControl
Control

Het onderliggende besturingselement om naar de weergave te schuiven.

Voorbeelden

In het volgende codevoorbeeld kunt u automatisch schuiven voor een formulier, het formaat van het formulier wijzigen en ervoor zorgen dat een knop zichtbaar blijft nadat het formulier is gewijzigd. Voor het voorbeeld moet u een Form met een Button benoemde naam button2 hebben.

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

Opmerkingen

De AutoScroll eigenschap moet worden ingesteld op true, en ten minste één van de schuifbalken, horizontaal of verticaal, moet ook zichtbaar zijn, zodat de ScrollControlIntoView methode een effect heeft. Als u de horizontale en verticale schuifbalken zichtbaar wilt maken, moeten respectievelijk de HScroll en VScroll eigenschappen worden ingesteld op true.

Als de activeControl parameter geen onderliggend besturingselement is, vindt er geen actie plaats.

Met deze methode kan de gebeurtenis worden Scroll gegenereerd.

Van toepassing op

Zie ook