本文整理汇总了VB.NET中System.Windows.Forms.Form.AutoSize属性的典型用法代码示例。如果您正苦于以下问题:VB.NET Form.AutoSize属性的具体用法?VB.NET Form.AutoSize怎么用?VB.NET Form.AutoSize使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Windows.Forms.Form
的用法示例。
在下文中一共展示了Form.AutoSize属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: FlowLayoutPanel
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.AutoSize = True
Me.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink
Me.Text = "URL Opener"
flowPanel = New FlowLayoutPanel()
flowPanel.AutoSize = True
flowPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink
Me.Controls.Add(flowPanel)
urlLabel = New Label()
urlLabel.Name = "urlLabel"
urlLabel.Text = "URL:"
urlLabel.Width = 50
urlLabel.TextAlign = ContentAlignment.MiddleCenter
flowPanel.Controls.Add(urlLabel)
urlTextBox = New TextBox()
urlTextBox.Name = "urlTextBox"
urlTextBox.Width = 250
flowPanel.Controls.Add(urlTextBox)
urlButton = New Button()
urlButton.Name = "urlButton"
urlButton.Text = "Open URL in Browser"
flowPanel.Controls.Add(urlButton)
End Sub
Private Sub urlButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles urlButton.Click
Try
Dim newUri As New Uri(urlTextBox.Text)
Catch uriEx As UriFormatException
MessageBox.Show(("Sorry, your URL is malformed. Try again. Error: " + uriEx.Message))
urlTextBox.ForeColor = Color.Red
Return
End Try
' Valid URI. Reset any previous error color, and launch the URL in the
' default browser.
' NOTE: Depending on the user's settings, this method of starting the
' browser may use an existing window in an existing Web browser process.
' To get around this, start up a specific browser instance instead using one of
' the overloads for Process.Start. You can examine the registry to find the
' current default browser and launch that, or hard-code a specific browser.
urlTextBox.ForeColor = Color.Black
Process.Start(urlTextBox.Text)
End Sub