VB.Net Tutorial/GUI/Form Properties

Материал из VB Эксперт
Перейти к: навигация, поиск

Blue 25 Percent Opaque

<source lang="vbnet">Imports System.Drawing Imports System.Drawing.Drawing2D Imports System.Windows.Forms public class Blue25PercentOpaque

  public Shared Sub Main
       Application.Run(New DrawingForm)
  End Sub

End class


Public Class DrawingForm

   Inherits System.Windows.Forms.Form
  1. Region " Windows Form Designer generated code "
   Public Sub New()
       MyBase.New()
       "This call is required by the Windows Form Designer.
       InitializeComponent()
       "Add any initialization after the InitializeComponent() call
   End Sub
   "Form overrides dispose to clean up the component list.
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
       If disposing Then
           If Not (components Is Nothing) Then
               components.Dispose()
           End If
       End If
       MyBase.Dispose(disposing)
   End Sub
   "Required by the Windows Form Designer
   Private components As System.ruponentModel.IContainer
   "NOTE: The following procedure is required by the Windows Form Designer
   "It can be modified using the Windows Form Designer.  
   "Do not modify it using the code editor.
   Friend WithEvents drawEllipseButton As System.Windows.Forms.Button
   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
       Me.drawEllipseButton = New System.Windows.Forms.Button()
       Me.SuspendLayout()
       "
       "drawEllipseButton
       "
       Me.drawEllipseButton.Location = New System.Drawing.Point(43, 32)
       Me.drawEllipseButton.Name = "drawEllipseButton"
       Me.drawEllipseButton.TabIndex = 1
       Me.drawEllipseButton.Text = "Draw Ellipse"
       "
       "Form1
       "
       Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
       Me.ClientSize = New System.Drawing.Size(160, 86)
       Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.drawEllipseButton})
       Me.Name = "Form1"
       Me.Text = "Form1"
       Me.ResumeLayout(False)
   End Sub
  1. End Region
   Private Sub DrawingForm_Paint(ByVal sender As Object, ByVal e As PaintEventArgs) Handles MyBase.Paint
       Dim blue25PercentOpaque As Color = Color.FromArgb(255 * 1 / 4, 0, 0, 255)
       Dim g As Graphics = e.Graphics
       Dim b As Brush = New SolidBrush(blue25PercentOpaque)
       g.FillEllipse(b, Me.ClientRectangle)
   End Sub

End Class</source>

Change Form Size

<source lang="vbnet">imports System imports System.Drawing imports System.Windows.Forms public class ControlSizeLocation : inherits Form

 Private WithEvents btnShow as Button
 Private WithEvents btnChange as Button
 public sub New()
   BackColor = Color.LightBlue
   ForeColor = Color.DarkBlue
   Size = new Size(350,200)
   btnShow = new Button()
   btnShow.Location = new Point(50,50)
   btnShow.Size = new Size(100,23)
   btnShow.Text = "Show"
   btnShow.Parent = me
   btnChange = new Button()
   btnChange.Location = new Point(200,50)
   btnChange.Size = new Size(100,23)
   btnChange.Text = "Change"
   btnChange.Parent = me
 end sub
 public shared sub Main() 
   Application.Run(new ControlSizeLocation())
 end sub
 private sub btnShow_Click(ByVal sender as object,ByVal e as EventArgs) Handles btnShow.Click
   Console.WriteLine("Button Bottom:  " + btnShow.Bottom.ToString())
   Console.WriteLine("Button Top:  " + btnShow.Top.ToString())
   Console.WriteLine("Button Left:  " + btnShow.Left.ToString())
   Console.WriteLine("Button Right:  " + btnShow.Right.ToString())
   Console.WriteLine("Button Location: " + btnShow.Location.ToString())
   Console.WriteLine("Button Width:  " + btnShow.Width.ToString())
   Console.WriteLine("Button Height:  " + btnShow.Height.ToString())
   Console.WriteLine("Button Size:  " + btnShow.Size.ToString())
   Console.WriteLine("Button ClientSize:  " + btnShow.ClientSize.ToString())
   Console.WriteLine("Form Size:  " + me.Size.ToString())
   Console.WriteLine("Form ClientSize: " + me.ClientSize.ToString())
 end sub
 private sub btnChange_Click(ByVal sender as object,ByVal e as EventArgs)Handles btnChange.Click
   me.Size = new Size(800,200)
 end sub

end class</source>

Change Form Size, Text, Background Color and button font

<source lang="vbnet">Imports System.Windows.Forms public class FormDemo

  public Shared Sub Main
       Application.Run(New Form1)
  End Sub

End class Public Class Form1

   Inherits System.Windows.Forms.Form
  1. Region " Windows Form Designer generated code "
   Public Sub New()
       MyBase.New()
       "This call is required by the Windows Form Designer.
       InitializeComponent()
       "Add any initialization after the InitializeComponent() call
   End Sub
   "Form overrides dispose to clean up the component list.
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
       If disposing Then
           If Not (components Is Nothing) Then
               components.Dispose()
           End If
       End If
       MyBase.Dispose(disposing)
   End Sub
   Friend WithEvents Button1 As System.Windows.Forms.Button
   Friend WithEvents Button2 As System.Windows.Forms.Button
   Friend WithEvents btnChangeColor As System.Windows.Forms.Button
   Friend WithEvents btnRGB As System.Windows.Forms.Button
   Friend WithEvents btnCompare As System.Windows.Forms.Button
   Friend WithEvents btnFont As System.Windows.Forms.Button
   Friend WithEvents btnBigger As System.Windows.Forms.Button
   Friend WithEvents btnSmaller As System.Windows.Forms.Button
   Friend WithEvents btnFormText As System.Windows.Forms.Button
   "Required by the Windows Form Designer
   Private components As System.ruponentModel.IContainer
   "NOTE: The following procedure is required by the Windows Form Designer
   "It can be modified using the Windows Form Designer.  
   "Do not modify it using the code editor.
   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
       Dim configurationAppSettings As System.Configuration.AppSettingsReader = New System.Configuration.AppSettingsReader()
       Me.Button1 = New System.Windows.Forms.Button()
       Me.Button2 = New System.Windows.Forms.Button()
       Me.btnChangeColor = New System.Windows.Forms.Button()
       Me.btnRGB = New System.Windows.Forms.Button()
       Me.btnCompare = New System.Windows.Forms.Button()
       Me.btnFont = New System.Windows.Forms.Button()
       Me.btnBigger = New System.Windows.Forms.Button()
       Me.btnSmaller = New System.Windows.Forms.Button()
       Me.btnFormText = New System.Windows.Forms.Button()
       Me.SuspendLayout()
       "
       "Button1
       "
       Me.Button1.Location = New System.Drawing.Point(56, 16)
       Me.Button1.Name = "Button1"
       Me.Button1.TabIndex = 1
       Me.Button1.TabStop = False
       Me.Button1.Text = "Button1"
       "
       "Button2
       "
       Me.Button2.Location = New System.Drawing.Point(216, 16)
       Me.Button2.Name = "Button2"
       Me.Button2.TabIndex = 0
       Me.Button2.TabStop = False
       Me.Button2.Text = "Button2"
       "
       "btnChangeColor
       "
       Me.btnChangeColor.Location = New System.Drawing.Point(56, 56)
       Me.btnChangeColor.Name = "btnChangeColor"
       Me.btnChangeColor.Size = New System.Drawing.Size(128, 23)
       Me.btnChangeColor.TabIndex = 2
       Me.btnChangeColor.Text = "Change Color"
       "
       "btnRGB
       "
       Me.btnRGB.Location = New System.Drawing.Point(56, 96)
       Me.btnRGB.Name = "btnRGB"
       Me.btnRGB.Size = New System.Drawing.Size(128, 23)
       Me.btnRGB.TabIndex = 3
       Me.btnRGB.Text = "Use RGB"
       "
       "btnCompare
       "
       Me.btnCompare.Location = New System.Drawing.Point(56, 136)
       Me.btnCompare.Name = "btnCompare"
       Me.btnCompare.Size = New System.Drawing.Size(128, 24)
       Me.btnCompare.TabIndex = 4
       Me.btnCompare.Text = "Compare"
       "
       "btnFont
       "
       Me.btnFont.Font = New System.Drawing.Font("Edwardian Script ITC", 20.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
       Me.btnFont.Location = New System.Drawing.Point(56, 184)
       Me.btnFont.Name = "btnFont"
       Me.btnFont.Size = New System.Drawing.Size(208, 64)
       Me.btnFont.TabIndex = 5
       Me.btnFont.Text = "Change Font!"
       "
       "btnBigger
       "
       Me.btnBigger.Location = New System.Drawing.Point(64, 264)
       Me.btnBigger.Name = "btnBigger"
       Me.btnBigger.Size = New System.Drawing.Size(80, 24)
       Me.btnBigger.TabIndex = 6
       Me.btnBigger.Text = "Bigger"
       "
       "btnSmaller
       "
       Me.btnSmaller.Location = New System.Drawing.Point(64, 304)
       Me.btnSmaller.Name = "btnSmaller"
       Me.btnSmaller.Size = New System.Drawing.Size(80, 24)
       Me.btnSmaller.TabIndex = 7
       Me.btnSmaller.Text = "Smaller"
       "
       "btnFormText
       "
       Me.btnFormText.Location = New System.Drawing.Point(64, 344)
       Me.btnFormText.Name = "btnFormText"
       Me.btnFormText.Size = New System.Drawing.Size(128, 32)
       Me.btnFormText.TabIndex = 8
       Me.btnFormText.Text = "Change Form Text"
       "
       "Form1
       "
       Me.AcceptButton = Me.Button2
       Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
       Me.AutoScroll = True
       Me.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(128, Byte), CType(128, Byte))
       Me.ClientSize = New System.Drawing.Size(320, 382)
       Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnFormText, Me.btnSmaller, Me.btnBigger, Me.btnFont, Me.btnCompare, Me.btnRGB, Me.btnChangeColor, Me.Button2, Me.Button1})
       Me.ForeColor = System.Drawing.Color.Black
       Me.Name = "Form1"
       Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
       Me.Text = "old value"
       Me.TopMost = True
       Me.ResumeLayout(False)
   End Sub
  1. End Region
   Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
       MsgBox("I am Button1!")
   End Sub
   Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
       MsgBox("I am Button2!")
   End Sub
   Private Sub btnChangeColor_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnChangeColor.Click
       Me.BackColor = System.Drawing.Color.Yellow
   End Sub
   Private Sub btnRGB_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRGB.Click
       Me.BackColor = System.Drawing.Color.Red
   End Sub
   Private Sub btnCompare_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCompare.Click
       Dim formcolor As System.Drawing.Color
       formcolor = Me.BackColor
       If System.Drawing.Color.op_Equality(formcolor, System.Drawing.color.AliceBlue) Then
           MsgBox("Color changed!")
       Else
           MsgBox("Not yet")
       End If
   End Sub
   Private Sub btnFont_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFont.Click
       Me.btnFont.Font = New System.Drawing.Font("WingDings", 20)
   End Sub
   Private Sub btnBigger_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnBigger.Click
       Me.Size = New System.Drawing.Size(500, 600)
   End Sub
   Private Sub btnSmaller_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSmaller.Click
       Me.Size = New System.Drawing.Size(100, 150)
   End Sub
   Private Sub btnFormText_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFormText.Click
       Me.Text = " new Text"
   End Sub

End Class</source>

Form Opacity

<source lang="vbnet">Imports System.Windows.Forms public class FormOpacity

  public Shared Sub Main
       Application.Run(New Form1)
  End Sub

End class

Public Class Form1

   Inherits System.Windows.Forms.Form
  1. Region " Windows Form Designer generated code "
   Public Sub New()
       MyBase.New()
       "This call is required by the Windows Form Designer.
       InitializeComponent()
       "Add any initialization after the InitializeComponent() call
   End Sub
   "Form overrides dispose to clean up the component list.
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
       If disposing Then
           If Not (components Is Nothing) Then
               components.Dispose()
           End If
       End If
       MyBase.Dispose(disposing)
   End Sub
   "Required by the Windows Form Designer
   Private components As System.ruponentModel.IContainer
   "NOTE: The following procedure is required by the Windows Form Designer
   "It can be modified using the Windows Form Designer.  
   "Do not modify it using the code editor.
   Friend WithEvents timer1 As System.Windows.Forms.Timer
   Friend WithEvents label1 As System.Windows.Forms.Label
   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
       Me.ruponents = New System.ruponentModel.Container()
       Me.timer1 = New System.Windows.Forms.Timer(Me.ruponents)
       Me.label1 = New System.Windows.Forms.Label()
       Me.SuspendLayout()
       "
       "timer1
       "
       "
       "label1
       "
       Me.label1.Location = New System.Drawing.Point(96, 24)
       Me.label1.Name = "label1"
       Me.label1.TabIndex = 1
       Me.label1.Text = "Click On Me!"
       Me.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
       "
       "Form1
       "
       Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
       Me.ClientSize = New System.Drawing.Size(292, 70)
       Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.label1})
       Me.Name = "Form1"
       Me.Opacity = 0.7
       Me.Text = "Opacity = 0.5"
       Me.ResumeLayout(False)
   End Sub
  1. End Region
   Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
   End Sub
   Private Sub timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles timer1.Tick
       If Me.Opacity < 1.0 Then Me.Opacity = Me.Opacity + 0.1
       Me.Text = "Opacity = " & Me.Opacity.ToString()
   End Sub
   Private Sub Form1_Deactivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Deactivate
       timer1.Enabled = False
   End Sub
   Private Sub label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles label1.Click
       If Me.Opacity < 1.0 Then Me.Opacity = Me.Opacity + 0.1
       Me.Text = "Opacity = " & Me.Opacity.ToString()
   End Sub

End Class</source>

Override the DefaultSize property to gain better performance

<source lang="vbnet">imports System imports System.Drawing imports System.Windows.Forms public class FormSizeLocation : inherits Form

 private lbl as Label
 "  Override the DefaultSize property to gain better performance
 protected ReadOnly overrides Property DefaultSize as Size
   get
     return new Size(400,400)
   end get
 end property
 public sub New()
       Text = "Control Parent"
   BackColor = Color.LightBlue
   ForeColor = Color.DarkBlue
   Size = new Size(350,200)
 end sub
 public shared sub Main() 
   Application.Run(new FormSizeLocation())
 end sub

end class</source>

Set Form Background color

<source lang="vbnet">Imports System.Drawing Imports System.Drawing.Drawing2D Imports System.Windows.Forms public class ColorDialogSetForgroundBackgroundColor

  public Shared Sub Main
       Application.Run(New FrmColorDialogTest)
  End Sub

End class Public Class FrmColorDialogTest

  Inherits System.Windows.Forms.Form
  Friend WithEvents cmdBackgroundButton As Button
  Friend WithEvents cmdTextButton As Button
  1. Region " Windows Form Designer generated code "
  Public Sub New()
     MyBase.New()
     "This call is required by the Windows Form Designer.
     InitializeComponent()
     "Add any initialization after the InitializeComponent() call
  End Sub
  "Form overrides dispose to clean up the component list.
  Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
     If disposing Then
        If Not (components Is Nothing) Then
           components.Dispose()
        End If
     End If
     MyBase.Dispose(disposing)
  End Sub
  "Required by the Windows Form Designer
  Private components As System.ruponentModel.Container
  "NOTE: The following procedure is required by the Windows Form Designer
  "It can be modified using the Windows Form Designer.  
  "Do not modify it using the code editor.
  <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
     Me.cmdBackgroundButton = New System.Windows.Forms.Button()
     Me.cmdTextButton = New System.Windows.Forms.Button()
     Me.SuspendLayout()
     "
     "cmdBackgroundButton
     "
     Me.cmdBackgroundButton.Location = New System.Drawing.Point(16, 16)
     Me.cmdBackgroundButton.Name = "cmdBackgroundButton"
     Me.cmdBackgroundButton.Size = New System.Drawing.Size(160, 24)
     Me.cmdBackgroundButton.TabIndex = 0
     Me.cmdBackgroundButton.Text = "Change Background Color"
     "
     "cmdTextButton
     "
     Me.cmdTextButton.Location = New System.Drawing.Point(16, 56)
     Me.cmdTextButton.Name = "cmdTextButton"
     Me.cmdTextButton.Size = New System.Drawing.Size(160, 24)
     Me.cmdTextButton.TabIndex = 1
     Me.cmdTextButton.Text = "Change Text Color"
     "
     "FrmColorDialogTest
     "
     Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
     Me.ClientSize = New System.Drawing.Size(192, 93)
     Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.cmdTextButton, Me.cmdBackgroundButton})
     Me.Name = "FrmColorDialogTest"
     Me.Text = "Using Color Dialogs"
     Me.ResumeLayout(False)
  End Sub
  1. End Region
  Dim colorBox As ColorDialog = New ColorDialog()
  Private Sub cmdTextButton_Click(ByVal sender As System.Object, _
     ByVal e As System.EventArgs) Handles cmdTextButton.Click
     Dim result As DialogResult
     result = colorBox.ShowDialog()
     If result = DialogResult.Cancel Then
        Return
     End If
     cmdBackgroundButton.ForeColor = colorBox.Color
     cmdTextButton.ForeColor = colorBox.Color
  End Sub 
  Private Sub cmdBackgroundButton_Click( _
     ByVal sender As System.Object, _
     ByVal e As System.EventArgs) _
     Handles cmdBackgroundButton.Click
     Dim result As DialogResult
     colorBox.FullOpen = True
     result = colorBox.ShowDialog()
     If result = DialogResult.Cancel Then
        Return
     End If
     Me.BackColor = colorBox.Color
  End Sub

End Class</source>

Set Form background image

<source lang="vbnet">Imports System.Drawing Imports System.Drawing.Drawing2D Imports System.Windows.Forms public class FormBackgroundPicture

  public Shared Sub Main
       Application.Run(New Form1)
  End Sub

End class Public Class Form1

   Inherits System.Windows.Forms.Form
  1. Region " Windows Form Designer generated code "
   Public Sub New()
       MyBase.New()
       "This call is required by the Windows Form Designer.
       InitializeComponent()
       "Add any initialization after the InitializeComponent() call
   End Sub
   "Form overrides dispose to clean up the component list.
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
       If disposing Then
           If Not (components Is Nothing) Then
               components.Dispose()
           End If
       End If
       MyBase.Dispose(disposing)
   End Sub
   "Required by the Windows Form Designer
   Private components As System.ruponentModel.IContainer
   "NOTE: The following procedure is required by the Windows Form Designer
   "It can be modified using the Windows Form Designer.  
   "Do not modify it using the code editor.
   Friend WithEvents Button1 As System.Windows.Forms.Button
   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
       Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
       Me.Button1 = New System.Windows.Forms.Button
       Me.SuspendLayout()
       "
       "Button1
       "
       Me.Button1.Location = New System.Drawing.Point(152, 88)
       Me.Button1.Name = "Button1"
       Me.Button1.TabIndex = 0
       Me.Button1.Text = "Close"
       "
       "Form1
       "
       Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
       Me.BackgroundImage = System.Drawing.Image.FromFile("yourfile.jpg")
       Me.ClientSize = New System.Drawing.Size(376, 208)
       Me.Controls.Add(Me.Button1)
       Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
       Me.Name = "Form1"
       Me.Text = "Form1"
       Me.TransparencyKey = System.Drawing.Color.White
       Me.ResumeLayout(False)
   End Sub
  1. End Region
   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       Me.Close()
   End Sub

End Class</source>

Set TransparencyKey

<source lang="vbnet">Imports System.Windows.Forms public class SetTransparencyKey

  public Shared Sub Main
       Application.Run(New Form1)
  End Sub

End class Public Class Form1

   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       TransparencyKey = BackColor
   End Sub

End Class <Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _ Partial Public Class Form1

   Inherits System.Windows.Forms.Form
   "Form overrides dispose to clean up the component list.
   <System.Diagnostics.DebuggerNonUserCode()> _
   Protected Overrides Sub Dispose(ByVal disposing As Boolean)
       If disposing AndAlso components IsNot Nothing Then
           components.Dispose()
       End If
       MyBase.Dispose(disposing)
   End Sub
   "Required by the Windows Form Designer
   Private components As System.ruponentModel.IContainer
   "NOTE: The following procedure is required by the Windows Form Designer
   "It can be modified using the Windows Form Designer.  
   "Do not modify it using the code editor.
   <System.Diagnostics.DebuggerStepThrough()> _
   Private Sub InitializeComponent()
       Me.Button1 = New System.Windows.Forms.Button
       Me.Button2 = New System.Windows.Forms.Button
       Me.Button3 = New System.Windows.Forms.Button
       Me.Label1 = New System.Windows.Forms.Label
       Me.TextBox1 = New System.Windows.Forms.TextBox
       Me.TextBox2 = New System.Windows.Forms.TextBox
       Me.Label2 = New System.Windows.Forms.Label
       Me.TextBox3 = New System.Windows.Forms.TextBox
       Me.Label3 = New System.Windows.Forms.Label
       Me.TextBox4 = New System.Windows.Forms.TextBox
       Me.Label4 = New System.Windows.Forms.Label
       Me.ruboBox1 = New System.Windows.Forms.ruboBox
       Me.Label5 = New System.Windows.Forms.Label
       Me.TextBox5 = New System.Windows.Forms.TextBox
       Me.Label6 = New System.Windows.Forms.Label
       Me.SuspendLayout()
       "
       "Button1
       "
       Me.Button1.Location = New System.Drawing.Point(8, 8)
       Me.Button1.Name = "Button1"
       Me.Button1.Size = New System.Drawing.Size(75, 23)
       Me.Button1.TabIndex = 0
       Me.Button1.Text = "Button1"
       Me.Button1.UseVisualStyleBackColor = True
       "
       "Button2
       "
       Me.Button2.Location = New System.Drawing.Point(88, 8)
       Me.Button2.Name = "Button2"
       Me.Button2.Size = New System.Drawing.Size(75, 23)
       Me.Button2.TabIndex = 1
       Me.Button2.Text = "Button2"
       Me.Button2.UseVisualStyleBackColor = True
       "
       "Button3
       "
       Me.Button3.Location = New System.Drawing.Point(168, 8)
       Me.Button3.Name = "Button3"
       Me.Button3.Size = New System.Drawing.Size(75, 23)
       Me.Button3.TabIndex = 2
       Me.Button3.Text = "Button3"
       Me.Button3.UseVisualStyleBackColor = True
       "
       "Label1
       "
       Me.Label1.AutoSize = True
       Me.Label1.Location = New System.Drawing.Point(8, 56)
       Me.Label1.Name = "Label1"
       Me.Label1.Size = New System.Drawing.Size(57, 13)
       Me.Label1.TabIndex = 3
       Me.Label1.Text = "First Name"
       "
       "TextBox1
       "
       Me.TextBox1.Location = New System.Drawing.Point(80, 56)
       Me.TextBox1.Name = "TextBox1"
       Me.TextBox1.Size = New System.Drawing.Size(168, 20)
       Me.TextBox1.TabIndex = 4
       Me.TextBox1.Text = "A"
       "
       "TextBox2
       "
       Me.TextBox2.Location = New System.Drawing.Point(80, 80)
       Me.TextBox2.Name = "TextBox2"
       Me.TextBox2.Size = New System.Drawing.Size(168, 20)
       Me.TextBox2.TabIndex = 6
       Me.TextBox2.Text = "A"
       "
       "Label2
       "
       Me.Label2.AutoSize = True
       Me.Label2.Location = New System.Drawing.Point(8, 80)
       Me.Label2.Name = "Label2"
       Me.Label2.Size = New System.Drawing.Size(58, 13)
       Me.Label2.TabIndex = 5
       Me.Label2.Text = "Last Name"
       "
       "TextBox3
       "
       Me.TextBox3.Location = New System.Drawing.Point(80, 128)
       Me.TextBox3.Name = "TextBox3"
       Me.TextBox3.Size = New System.Drawing.Size(168, 20)
       Me.TextBox3.TabIndex = 10
       Me.TextBox3.Text = "E"
       "
       "Label3
       "
       Me.Label3.AutoSize = True
       Me.Label3.Location = New System.Drawing.Point(8, 128)
       Me.Label3.Name = "Label3"
       Me.Label3.Size = New System.Drawing.Size(24, 13)
       Me.Label3.TabIndex = 9
       Me.Label3.Text = "City"
       "
       "TextBox4
       "
       Me.TextBox4.Location = New System.Drawing.Point(80, 104)
       Me.TextBox4.Name = "TextBox4"
       Me.TextBox4.Size = New System.Drawing.Size(168, 20)
       Me.TextBox4.TabIndex = 8
       Me.TextBox4.Text = "3"
       "
       "Label4
       "
       Me.Label4.AutoSize = True
       Me.Label4.Location = New System.Drawing.Point(8, 104)
       Me.Label4.Name = "Label4"
       Me.Label4.Size = New System.Drawing.Size(35, 13)
       Me.Label4.TabIndex = 7
       Me.Label4.Text = "Street"
       "
       "ComboBox1
       "
       Me.ruboBox1.FormattingEnabled = True
       Me.ruboBox1.Location = New System.Drawing.Point(80, 152)
       Me.ruboBox1.Name = "ComboBox1"
       Me.ruboBox1.Size = New System.Drawing.Size(48, 21)
       Me.ruboBox1.TabIndex = 11
       Me.ruboBox1.Text = "HI"
       "
       "Label5
       "
       Me.Label5.AutoSize = True
       Me.Label5.Location = New System.Drawing.Point(8, 152)
       Me.Label5.Name = "Label5"
       Me.Label5.Size = New System.Drawing.Size(32, 13)
       Me.Label5.TabIndex = 12
       Me.Label5.Text = "State"
       "
       "TextBox5
       "
       Me.TextBox5.Location = New System.Drawing.Point(176, 152)
       Me.TextBox5.Name = "TextBox5"
       Me.TextBox5.Size = New System.Drawing.Size(72, 20)
       Me.TextBox5.TabIndex = 14
       Me.TextBox5.Text = "1"
       "
       "Label6
       "
       Me.Label6.AutoSize = True
       Me.Label6.Location = New System.Drawing.Point(144, 152)
       Me.Label6.Name = "Label6"
       Me.Label6.Size = New System.Drawing.Size(22, 13)
       Me.Label6.TabIndex = 13
       Me.Label6.Text = "Zip"
       "
       "Form1
       "
       Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
       Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
       Me.ClientSize = New System.Drawing.Size(257, 181)
       Me.Controls.Add(Me.TextBox5)
       Me.Controls.Add(Me.Label6)
       Me.Controls.Add(Me.Label5)
       Me.Controls.Add(Me.ruboBox1)
       Me.Controls.Add(Me.TextBox3)
       Me.Controls.Add(Me.Label3)
       Me.Controls.Add(Me.TextBox4)
       Me.Controls.Add(Me.Label4)
       Me.Controls.Add(Me.TextBox2)
       Me.Controls.Add(Me.Label2)
       Me.Controls.Add(Me.TextBox1)
       Me.Controls.Add(Me.Label1)
       Me.Controls.Add(Me.Button3)
       Me.Controls.Add(Me.Button2)
       Me.Controls.Add(Me.Button1)
       Me.Name = "Form1"
       Me.Text = "GhostForm"
       Me.ResumeLayout(False)
       Me.PerformLayout()
   End Sub
   Friend WithEvents Button1 As System.Windows.Forms.Button
   Friend WithEvents Button2 As System.Windows.Forms.Button
   Friend WithEvents Button3 As System.Windows.Forms.Button
   Friend WithEvents Label1 As System.Windows.Forms.Label
   Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
   Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
   Friend WithEvents Label2 As System.Windows.Forms.Label
   Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
   Friend WithEvents Label3 As System.Windows.Forms.Label
   Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
   Friend WithEvents Label4 As System.Windows.Forms.Label
   Friend WithEvents ComboBox1 As System.Windows.Forms.ruboBox
   Friend WithEvents Label5 As System.Windows.Forms.Label
   Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
   Friend WithEvents Label6 As System.Windows.Forms.Label

End Class</source>

Transparent Form: Opacity = 0.66

<source lang="vbnet">Imports System.Windows.Forms public class FormTransparent

  public Shared Sub Main
       Application.Run(New Form1)
  End Sub

End class <Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _ Partial Public Class Form1

   Inherits System.Windows.Forms.Form
   "Form overrides dispose to clean up the component list.
   <System.Diagnostics.DebuggerNonUserCode()> _
   Protected Overrides Sub Dispose(ByVal disposing As Boolean)
       If disposing AndAlso components IsNot Nothing Then
           components.Dispose()
       End If
       MyBase.Dispose(disposing)
   End Sub
   "Required by the Windows Form Designer
   Private components As System.ruponentModel.IContainer
   "NOTE: The following procedure is required by the Windows Form Designer
   "It can be modified using the Windows Form Designer.  
   "Do not modify it using the code editor.
   <System.Diagnostics.DebuggerStepThrough()> _
   Private Sub InitializeComponent()
       Me.SuspendLayout()
       "
       "Form1
       "
       Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
       Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
       Me.ClientSize = New System.Drawing.Size(292, 273)
       Me.Name = "Form1"
       Me.Opacity = 0.66
       Me.Text = "SemiTransparent"
       Me.ResumeLayout(False)
   End Sub

End Class</source>