Nasıl yapılır: Pencereyi İçeriğine Sığacak Şekilde Otomatik Olarak Boyutla

Bu örnekte, bir pencerenin içeriğine SizeToContent sığacak şekilde nasıl yeniden boyutlandırılır olduğunu belirtmek için özelliğinin nasıl ayarlan olduğu gösterilir.

Örnek


// 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;

' 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