Form.AutoScroll Tulajdonság
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Lekéri vagy beállít egy értéket, amely jelzi, hogy az űrlap engedélyezi-e az automatikus regisztrációt.
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
Tulajdonság értéke
trueaz automatikus regisztráció engedélyezése az űrlapon; egyéb esetben. false Az alapértelmezett érték a false.
Példák
Az alábbi példa bemutatja, hogyan használhatja a tulajdonságot az AutoScroll űrlap ügyfélterületét túllépő vezérlők megjelenítésének engedélyezésére. A példa létrehoz egy új űrlapot, és hozzáad egy vezérlőt Button az űrlaphoz. A Button vezérlő az új űrlap ügyfélterületét helyezi el. A AutoScroll tulajdonság igaz értékre van állítva, hogy görgetősávokat jelenítsen meg az űrlapon, hogy a felhasználó görgethessen a vezérlőhöz. Ez a példa megköveteli, hogy a példában definiált metódust egy eseménykezelő vagy más metódus egy másik űrlapjáról hívja meg.
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
Megjegyzések
Ha ez a tulajdonság be van állítva true, görgetősávok jelennek meg az űrlapon, ha a vezérlők az űrlap ügyfélrégióján kívül találhatók. Emellett ha az automatikus regisztráció be van kapcsolva, az űrlap ügyfélterülete automatikusan görget, hogy láthatóvá tegye a beviteli fókuszt tartalmazó vezérlőt.
Ezzel a tulajdonságtal megakadályozhatja, hogy a felhasználók elveszítsék a vezérlők megtekintésének képességét, ha a videófeloldási beállítások alacsony felbontásra vannak beállítva.