Mega Code Archive

 
Categories / VB.Net Tutorial / GUI
 

Constrol Anchor

Imports System.Windows.Forms public class ControlAnchor    public Shared Sub Main         Application.Run(New Form1)    End Sub End class Public Class Form1     Inherits System.Windows.Forms.Form     Public Sub New()         MyBase.New()         InitializeComponent()     End Sub     Private components As System.ComponentModel.IContainer     Friend WithEvents textBox1 As System.Windows.Forms.TextBox     Friend WithEvents label1 As System.Windows.Forms.Label     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()         Me.textBox1 = New System.Windows.Forms.TextBox()         Me.label1 = New System.Windows.Forms.Label()         Me.SuspendLayout()         Me.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _                     Or System.Windows.Forms.AnchorStyles.Right)         Me.textBox1.Location = New System.Drawing.Point(144, 16)         Me.textBox1.Name = "textBox1"         Me.textBox1.Size = New System.Drawing.Size(116, 20)         Me.textBox1.TabIndex = 3         Me.textBox1.Text = "textBox1"         '         'label1         '         Me.label1.Location = New System.Drawing.Point(8, 16)         Me.label1.Name = "label1"         Me.label1.Size = New System.Drawing.Size(125, 20)         Me.label1.TabIndex = 2         Me.label1.Text = "My perfectly-sized label"         Me.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft         '         'Form1         '         Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)         Me.ClientSize = New System.Drawing.Size(272, 54)         Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.textBox1, Me.label1})         Me.ResumeLayout(False)     End Sub End Class