ScrollableControl.SetAutoScrollMargin(Int32, Int32) Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee stelt u de grootte van de marges voor automatisch schuiven in.
public:
void SetAutoScrollMargin(int x, int y);
public void SetAutoScrollMargin(int x, int y);
member this.SetAutoScrollMargin : int * int -> unit
Public Sub SetAutoScrollMargin (x As Integer, y As Integer)
Parameters
Voorbeelden
In het volgende codevoorbeeld wordt de afgeleide klasse gebruikt. Panel Het voorbeeld evalueert de locatie van een tekstvak en wijzigt het uiterlijk en gedrag van de bovenliggende container, het configuratiescherm. Voor het voorbeeld moet u een exemplaar van een Panel besturingselement hebben gemaakt, TextBoxen Button. Plaats het vak op het paneel, zodat deze ten minste één van de randen van het paneel overlapt. Roep deze subprocedure aan met een klik op een knop om het verschil in het gedrag en uiterlijk van het deelvenster te zien.
void MySub()
{
/* If the text box is outside the panel's bounds,
turn on auto-scrolling and set the margin. */
if ( text1->Location.X > panel1->Location.X || text1->Location.Y > panel1->Location.Y )
{
panel1->AutoScroll = true;
/* If the AutoScrollMargin is set to
less than (5,5), set it to 5,5. */
if ( panel1->AutoScrollMargin.Width < 5 || panel1->AutoScrollMargin.Height < 5 )
{
panel1->SetAutoScrollMargin( 5, 5 );
}
}
}
private void MySub()
{
/* If the text box is outside the panel's bounds,
turn on auto-scrolling and set the margin. */
if (text1.Location.X > panel1.Location.X ||
text1.Location.Y > panel1.Location.Y)
{
panel1.AutoScroll = true;
/* If the AutoScrollMargin is set to
less than (5,5), set it to 5,5. */
if(panel1.AutoScrollMargin.Width < 5 ||
panel1.AutoScrollMargin.Height < 5)
{
panel1.SetAutoScrollMargin(5, 5);
}
}
}
Private Sub MySub()
' If the text box is outside the panel's bounds,
' turn on auto-scrolling and set the margin.
If (text1.Location.X > panel1.Location.X) Or _
(text1.Location.Y > panel1.Location.Y) Then
panel1.AutoScroll = True
' If the AutoScrollMargin is set to
' less than (5,5), set it to 5,5.
If (panel1.AutoScrollMargin.Width < 5) Or _
(panel1.AutoScrollMargin.Height < 5) Then
panel1.SetAutoScrollMargin(5, 5)
End If
End If
End Sub
Opmerkingen
De marge stelt de breedte en hoogte van de rand rond elk besturingselement in. Deze marge wordt gebruikt om te bepalen wanneer schuifbalken nodig zijn in de container en waar u naar kunt schuiven wanneer een besturingselement is geselecteerd.
Note
Als een negatief getal wordt doorgegeven als de x of y waarden, wordt de waarde opnieuw ingesteld op 0.