ScrollableControl.ScrollControlIntoView(Control) Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Desloca o controlo filho especificado para a visualização num controlo ativado com auto-scroll.
public:
void ScrollControlIntoView(System::Windows::Forms::Control ^ activeControl);
public void ScrollControlIntoView(System.Windows.Forms.Control activeControl);
member this.ScrollControlIntoView : System.Windows.Forms.Control -> unit
Public Sub ScrollControlIntoView (activeControl As Control)
Parâmetros
- activeControl
- Control
O controlo da criança para rolar para aparecer.
Exemplos
O exemplo de código seguinte permite o auto-scrolling de um formulário, redimensiona o formulário e garante que um botão permanece visível após o redimensionamento do formulário. O exemplo exige que tenhas um Form com um Button nome button2 .
private:
void ResizeForm()
{
// Enable auto-scrolling for the form.
this->AutoScroll = true;
// Resize the form.
Rectangle r = this->ClientRectangle;
// Subtract 100 pixels from each side of the Rectangle.
r.Inflate( -100, -100 );
this->Bounds = this->RectangleToScreen( r );
// Make sure button2 is visible.
this->ScrollControlIntoView( button2 );
}
private void ResizeForm()
{
// Enable auto-scrolling for the form.
this.AutoScroll = true;
// Resize the form.
Rectangle r = this.ClientRectangle;
// Subtract 100 pixels from each side of the Rectangle.
r.Inflate(-100, -100);
this.Bounds = this.RectangleToScreen(r);
// Make sure button2 is visible.
this.ScrollControlIntoView(button2);
}
Private Sub ResizeForm()
' Enable auto-scrolling for the form.
Me.AutoScroll = True
' Resize the form.
Dim r As Rectangle = Me.ClientRectangle
' Subtract 100 pixels from each side of the Rectangle.
r.Inflate(- 100, - 100)
Me.Bounds = Me.RectangleToScreen(r)
' Make sure button2 is visible.
Me.ScrollControlIntoView(button2)
End Sub
Observações
A AutoScroll propriedade deve ser definida para true, e pelo menos uma das barras de scroll, horizontal ou vertical, também deve ser visível, para que o ScrollControlIntoView método tenha efeito. Para tornar visíveis as barras de scroll horizontais e verticais, as HScroll propriedades e VScroll , respetivamente, devem ser definidas para true.
Se o activeControl parâmetro não for um controlo filho, não ocorre qualquer ação.
Este método pode aumentar o Scroll evento.