form1.frm

来自「vb 窗体实例 都是自己的例子」· FRM 代码 · 共 79 行

FRM
79
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "设置窗口在屏幕中的位置"
   ClientHeight    =   3135
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4860
   LinkTopic       =   "Form1"
   ScaleHeight     =   3135
   ScaleWidth      =   4860
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command5 
      Caption         =   "右下脚"
      Height          =   705
      Left            =   3735
      TabIndex        =   4
      Top             =   2385
      Width           =   1050
   End
   Begin VB.CommandButton Command4 
      Caption         =   "居中"
      Height          =   705
      Left            =   1830
      TabIndex        =   3
      Top             =   1095
      Width           =   1050
   End
   Begin VB.CommandButton Command3 
      Caption         =   "右上脚"
      Height          =   705
      Left            =   3735
      TabIndex        =   2
      Top             =   45
      Width           =   1050
   End
   Begin VB.CommandButton Command2 
      Caption         =   "左上脚"
      Height          =   705
      Left            =   75
      TabIndex        =   1
      Top             =   45
      Width           =   1050
   End
   Begin VB.CommandButton Command1 
      Caption         =   "左下脚"
      Height          =   705
      Left            =   75
      TabIndex        =   0
      Top             =   2385
      Width           =   1050
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()  '设置窗体在桌面左下角
  Me.Top = Screen.Height - Me.Height
  Me.Left = 0
End Sub
Private Sub Command2_Click()  '设置窗体在桌面左上角
  Me.Top = 0
  Me.Left = 0
End Sub
Private Sub Command3_Click()  '设置窗体在桌面右上角
  Me.Top = 0
  Me.Left = Screen.Width - Me.Width
End Sub
Private Sub Command4_Click()  '设置窗体在桌面中央
  If WindowState = 0 Then
     Move (Screen.Width - Form1.Width) / 2, (Screen.Height - Form1.Height) / 2
  End If
End Sub
Private Sub Command5_Click()  '设置窗体在桌面右下角
  Me.Top = Screen.Height - Me.Height
  Me.Left = Screen.Width - Me.Width
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?