ScrollableControl.ScrollControlIntoView(Control) 메서드

정의

자동 스크롤을 사용할 수 있는 컨트롤에서 지정된 자식 컨트롤을 뷰로 스크롤합니다.

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)

매개 변수

activeControl
Control

뷰로 스크롤할 자식 컨트롤입니다.

예제

다음 코드 예제에서는 폼에 대해 자동 스크롤을 사용하도록 설정하고, 폼의 크기를 조정하고, 폼의 크기를 조정한 후에도 단추가 계속 표시되도록 합니다. 이 예제에서는 이름이 인 button2FormButton 있어야 합니다.

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

설명

AutoScroll 속성을 로 true설정해야 하며, 메서드가 효과를 발휘하려면 스크롤 막대 중 하나 이상(가로 또는 세로)도 표시 ScrollControlIntoView 되어야 합니다. 가로 및 세로 스크롤 막대를 표시 HScroll 하려면 및 VScroll 속성을 각각 로 설정 true해야 합니다.

매개 변수가 activeControl 자식 컨트롤이 아니면 아무 작업도 수행되지 않습니다.

이 메서드는 이벤트를 발생 할 Scroll 수 있습니다.

적용 대상

추가 정보