Form.AutoScroll Vlastnost
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Získá nebo nastaví hodnotu určující, zda formulář umožňuje automatického zápisu.
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
truepovolení automatického zápisu ve formuláři; v opačném případě . false Výchozí hodnota je false.
Příklady
Následující příklad ukazuje, jak pomocí AutoScroll vlastnosti povolit zobrazení ovládacích prvků, které jsou mimo klientskou oblast formuláře. Příklad vytvoří nový formulář a přidá Button do formuláře ovládací prvek. Ovládací Button prvek se umístí mimo oblast klienta nového formuláře. Vlastnost AutoScroll je nastavena na hodnotu true pro zobrazení posuvníků ve formuláři, aby se uživatel mohl posunout na ovládací prvek. 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ěny mimo oblast klienta formuláře. Když je navíc zapnuté automatické zápisy, klientská oblast formuláře se automaticky posune, aby byl ovládací prvek se vstupním fokusem viditelný.
Tuto vlastnost můžete použít, pokud chcete uživatelům zabránit ztrátě možnosti zobrazení ovládacích prvků, když jsou nastavení rozlišení videa nastavená na nízké rozlišení.