當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。