Form.AutoScroll Vlastnost

Definice

Získá nebo nastaví hodnotu označující, jestli formulář povolí automatické zápisy.

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

Hodnota vlastnosti

Boolean

truepovolení automatického zápisu ve formuláři; v opačném případě . false Výchozí formát je false.

Příklady

Následující příklad ukazuje, jak použít AutoScroll vlastnost k povolení zobrazení ovládacích prvků, které jsou outsize klientské oblasti formuláře. Příklad vytvoří nový formulář a přidá Button ovládací prvek do formuláře. Ovládací Button prvek se umístí mimo oblast klienta nového formuláře. Vlastnost AutoScroll je nastavena na true pro zobrazení posuvníků ve formuláři, aby se uživatel mohl posunout k ovládacímu prvku. Tento příklad vyžaduje, aby metoda definovaná v tomto příkladu byla volána z jiného formuláře v obslužné rutině události nebo jiné metodě.

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

Poznámky

Pokud je tato vlastnost nastavena na true, posuvníky se zobrazí ve formuláři, pokud jsou některé ovládací prvky umístěné mimo oblast klienta formuláře. Kromě toho se při automatickém zápisu automaticky posune klientská oblast formuláře, aby byl ovládací prvek s fokusem vstupu viditelný.

Tuto vlastnost můžete použít, abyste uživatelům zabránili ztrátě možnosti zobrazení ovládacích prvků, když je nastavení rozlišení videa nastavené na nízké rozlišení.

Platí pro