Form.AutoScroll 속성

정의

폼에서 자동 스크롤 기능을 사용할 수 있는지를 나타내는 값을 가져오거나 설정합니다.

public:
 virtual property bool AutoScroll { bool get(); void set(bool value); };
public override bool AutoScroll { get; set; }
member this.AutoScroll : bool with get, set
Public Overrides Property AutoScroll As Boolean

속성 값

Boolean

폼에서 자동 스크롤 기능을 사용하는 경우 true이고, 그렇지 않으면 false입니다. 기본값은 false입니다.

예제

다음 예제에서는 폼의 AutoScroll 클라이언트 영역을 능가 하는 컨트롤의 표시를 사용 하도록 속성을 사용 하는 방법을 보여 줍니다. 이 예제에서는 새 폼을 만들고 폼에 컨트롤을 Button 추가합니다. Button 컨트롤의 위치가 새 양식의 클라이언트 영역 크기를 초과합니다. AutoScroll 사용자가 컨트롤로 스크롤할 수 있도록 폼에 스크롤 막대를 표시하려면 속성이 true로 설정됩니다. 이 예제에서는 이 예제에 정의된 메서드가 이벤트 처리기 또는 다른 메서드의 다른 양식에서 호출되어야 합니다.

private:
   void DisplayMyScrollableForm()
   {
      // Create a new form.
      Form^ form2 = gcnew Form;

      // Create a button to add to the new form.
      Button^ button1 = gcnew Button;

      // Set text for the button.
      button1->Text = "Scrolled Button";

      // Set the size of the button.
      button1->Size = System::Drawing::Size( 100, 30 );

      // Set the location of the button to be outside the form's client area.
      button1->Location = Point(form2->Size.Width + 200,form2->Size.Height + 200);

      // Add the button control to the new form.
      form2->Controls->Add( button1 );

      // Set the AutoScroll property to true to provide scrollbars.
      form2->AutoScroll = true;

      // Display the new form as a dialog box.
      form2->ShowDialog();
   }
private void DisplayMyScrollableForm()
{
   // Create a new form.
   Form form2 = new Form();
   // Create a button to add to the new form.
   Button button1 = new Button();
   // Set text for the button.
   button1.Text = "Scrolled Button";
   // Set the size of the button.
   button1.Size = new Size(100,30);
   // Set the location of the button to be outside the form's client area.
   button1.Location = new Point(form2.Size.Width + 200, form2.Size.Height + 200);

   // Add the button control to the new form.
   form2.Controls.Add(button1);
   // Set the AutoScroll property to true to provide scrollbars.
   form2.AutoScroll = true;

   // Display the new form as a dialog box.
   form2.ShowDialog();
}
Private Sub DisplayMyScrollableForm()
   ' Create a new form.
   Dim form2 As New Form()
   ' Create a button to add to the new form.
   Dim button1 As New Button()
   ' Set text for the button.
   button1.Text = "Scrolled Button"
   ' Set the size of the button.
   button1.Size = New Size(100, 30)
   ' Set the location of the button to be outside the form's client area.
   button1.Location = New Point(form2.Size.Width + 200, form2.Size.Height + 200)

   ' Add the button control to the new form.
   form2.Controls.Add(button1)
   ' Set the AutoScroll property to true to provide scrollbars.
   form2.AutoScroll = True

   ' Display the new form as a dialog box.
   form2.ShowDialog()
End Sub

설명

이 속성을 설정 true하면 폼의 클라이언트 영역 외부에 컨트롤이 있는 경우 폼에 스크롤 막대가 표시됩니다. 또한 자동 제어가 켜지면 양식의 클라이언트 영역이 자동으로 스크롤되어 입력 포커스가 있는 컨트롤이 표시됩니다.

이 속성을 사용하면 비디오 해상도 설정이 낮은 해상도로 설정된 경우 사용자가 컨트롤을 볼 수 없게 할 수 있습니다.

적용 대상