Cambiar la altura del panel del contenedor dividido en tiempo de ejecución

I have a splitcontainer and I would change the height of the panel1 at runtime. I use this code

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        SplitContainer1.Panel1.Height = 2
    End Sub

It's possible ? Does anybody have any suggestion?

Muchas gracias por adelantado.

preguntado el 28 de mayo de 14 a las 14:05

2 is a very small number. Are you sure you just don't want to call splitContainer1.Panel1Collapsed = true;? -

2 Respuestas

I think you're looking for the property SplitContainer.SplitterDistance. Desde el documentación:

Gets or sets the location of the splitter, in pixels, from the left or top edge of the SplitContainer.

contestado el 28 de mayo de 14 a las 14:05

Per my comment, you should consider just calling

splitContainer1.Panel1Collapsed = true;

since the height of 2 is a very small number. Not much use to the user.

Otherwise, you would have to set the following two properties:

splitContainer1.Panel1MinSize = 2;
splitContainer1.SplitterDistance = 2;

contestado el 28 de mayo de 14 a las 15:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.