Form.Size
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
#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.ComponentModel.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
#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
Related examples in the same category