ScrollableControl.ScrollControlIntoView(Control) ScrollableControl.ScrollControlIntoView(Control) ScrollableControl.ScrollControlIntoView(Control) ScrollableControl.ScrollControlIntoView(Control) Method

Definition

Desplaza el control secundario especificado en la vista de un control habilitado para desplazamiento automático. Scrolls the specified child control into view on an auto-scroll enabled control.

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)

Parámetros

activeControl
Control Control Control Control

Control secundario que se va a desplazar en la vista. The child control to scroll into view.

Examples

En el ejemplo de código siguiente se habilita el desplazamiento automático para un formulario, cambia el tamaño del formulario y garantiza que un botón permanece visible después de que se cambia el tamaño del formulario.The following code example enables auto-scrolling for a form, resizes the form, and ensures that a button remains visible after the form is resized. El ejemplo requiere que haya un Form con un Button denominado button2 en él.The example requires that you have a Form with a Button named button2 on it.

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

Remarks

El AutoScroll propiedad debe establecerse en true, y al menos una de las barras de desplazamiento, horizontal o vertical, también debe ser visible para el ScrollControlIntoView método tenga un efecto.The AutoScroll property must be set to true, and at least one of the scroll bars, horizontal or vertical, must also be visible, for the ScrollControlIntoView method to have an effect. Para que esté visible, las barras de desplazamiento horizontal y vertical del HScroll y VScroll respectivamente, propiedades, deben establecerse en true.To make the horizontal and vertical scroll bars visible, the HScroll and VScroll properties, respectively, must be set to true.

Si el activeControl parámetro no es un control secundario, realiza ninguna acción.If the activeControl parameter is not a child control, no action takes place.

Este método puede desencadenar el Scroll eventos.This method may raise the Scroll event.

Applies to

See Also