Compartir a través de


Cómo: Cambiar automáticamente el tamaño de una ventana para que se ajuste a su contenido

En este ejemplo se muestra cómo establecer la propiedad SizeToContent para especificar cómo cambia de tamaño una ventana para ajustarse a su contenido.

Ejemplo


            ' Manually alter window height and width
            Me.SizeToContent = SizeToContent.Manual

            ' Automatically resize width relative to content
            Me.SizeToContent = SizeToContent.Width

            ' Automatically resize height relative to content
            Me.SizeToContent = SizeToContent.Height

            ' Automatically resize height and width relative to content
            Me.SizeToContent = SizeToContent.WidthAndHeight

// Manually alter window height and width
this.SizeToContent = SizeToContent.Manual;

// Automatically resize width relative to content
this.SizeToContent = SizeToContent.Width;

// Automatically resize height relative to content
this.SizeToContent = SizeToContent.Height;

// Automatically resize height and width relative to content
this.SizeToContent = SizeToContent.WidthAndHeight;