Form.AutoScroll Eigenschap

Definitie

Hiermee wordt een waarde opgehaald of ingesteld die aangeeft of het formulier automatisch inschrijven inschakelt.

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

Waarde van eigenschap

true automatisch inschrijven in het formulier in te schakelen; anders, false. De standaardwaarde is false.

Voorbeelden

In het volgende voorbeeld ziet u hoe u de AutoScroll eigenschap gebruikt om de weergave van besturingselementen in te schakelen die het clientgebied van een formulier groter maken. In het voorbeeld wordt een nieuw formulier gemaakt en wordt een Button besturingselement aan het formulier toegevoegd. Het Button besturingselement wordt het clientgebied van het nieuwe formulier uitgelicht. De AutoScroll eigenschap is ingesteld op true om schuifbalken op het formulier weer te geven, zodat de gebruiker naar het besturingselement kan schuiven. Voor dit voorbeeld is vereist dat de in dit voorbeeld gedefinieerde methode wordt aangeroepen vanuit een ander formulier in een gebeurtenis-handler of een andere methode.

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

Opmerkingen

Als deze eigenschap is ingesteld trueop, worden schuifbalken weergegeven op het formulier als er besturingselementen zich buiten de clientregio van het formulier bevinden. Wanneer automatisch inschrijven is ingeschakeld, schuift het clientgebied van het formulier automatisch om het besturingselement met invoerfocus zichtbaar te maken.

U kunt deze eigenschap gebruiken om te voorkomen dat gebruikers de mogelijkheid verliezen om besturingselementen weer te geven wanneer hun videoresolutie-instellingen zijn ingesteld op een lage resolutie.

Van toepassing op