当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET Form.Size属性代码示例

本文整理汇总了VB.NET中System.Windows.Forms.Form.Size属性的典型用法代码示例。如果您正苦于以下问题:VB.NET Form.Size属性的具体用法?VB.NET Form.Size怎么用?VB.NET Form.Size使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在System.Windows.Forms.Form的用法示例。


在下文中一共展示了Form.Size属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。

示例1: CreateMyOpaqueForm

Private Sub CreateMyOpaqueForm()
   ' Create a new form.
   Dim form2 As New Form()
   ' Set the text displayed in the caption.
   form2.Text = "My Form"
   ' Set the opacity to 75%.
   form2.Opacity = 0.75
   ' Size the form to be 300 pixels in height and width.
   form2.Size = New Size(300, 300)
   ' Display the form in the center of the screen.
   form2.StartPosition = FormStartPosition.CenterScreen

   ' Display the form as a modal dialog box.
   form2.ShowDialog()
End Sub
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:15,代码来源:Form.Size

示例2: FormDemo

' 导入命名空间
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
开发者ID:VB程序员,项目名称:System.Windows.Forms,代码行数:197,代码来源:Form.Size


注:本文中的System.Windows.Forms.Form.Size属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。