ScrollableControl.ScrollControlIntoView(Control) Metódus

Definíció

A megadott gyermekvezérlőt egy automatikusan görgethető vezérlőelem nézetébe görgeti.

public:
 void ScrollControlIntoView(System::Windows::Forms::Control ^ activeControl);
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)

Paraméterek

activeControl
Control

A nézetbe görgetni kívánt gyermekvezérlő.

Példák

Az alábbi példakód lehetővé teszi az űrlap automatikus görgetését, átméretezi az űrlapot, és biztosítja, hogy az űrlap átméretezése után egy gomb látható maradjon. A példához szükség van egy Form névvel ellátott névvel Buttonbutton2 .

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

Megjegyzések

A AutoScroll tulajdonságot úgy kell beállítani, hogy truelegalább az egyik görgetősáv vízszintes vagy függőleges legyen, és láthatónak kell lennie ahhoz, hogy a ScrollControlIntoView metódus hatása érvényesüljön. A vízszintes és a függőleges görgetősávok láthatóvá tétele érdekében a tulajdonságokat és HScroll a VScroll tulajdonságokat a következőre truekell állítani: .

Ha a activeControl paraméter nem gyermekvezérlő, nem történik művelet.

Ez a módszer okozhatja az eseményt Scroll .

A következőre érvényes:

Lásd még