다음을 통해 공유


ScrollableControl.ScrollControlIntoView 메서드

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

네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)

구문

‘선언
Public Sub ScrollControlIntoView ( _
    activeControl As Control _
)
‘사용 방법
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
)

매개 변수

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

설명

ScrollControlIntoView 메서드가 제대로 실행되려면 AutoScroll 속성이 true로 설정되어야 하고 가로 또는 세로 스크롤 막대 중 적어도 하나가 표시되어 있어야 합니다. 가로 및 세로 스크롤 막대를 표시하려면 HScrollVScroll 속성을 각각 true로 설정해야 합니다.

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

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

예제

다음 코드 예제에서는 폼에 자동 스크롤을 사용하고, 폼의 크기를 조정하며, 폼의 크기가 조정된 후에도 단추가 표시되도록 합니다. 이 예제를 실행하려면 Formbutton2라는 Button이 있어야 합니다.

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

플랫폼

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

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

ScrollableControl 클래스
ScrollableControl 멤버
System.Windows.Forms 네임스페이스
AutoScroll
SetDisplayRectLocation
HScroll
VScroll
Scroll