共用方式為


HOW TO:配合視窗內容自動調整大小

本範例顯示如何設定 SizeToContent 屬性,以指定如何配合內容調整視窗大小。

範例


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