frmwindows.frm

来自「很好! 很实用! 免费!」· FRM 代码 · 共 118 行

FRM
118
字号
VERSION 5.00
Begin VB.Form frmWindows 
   Caption         =   "Windows List ..."
   ClientHeight    =   3195
   ClientLeft      =   2775
   ClientTop       =   3765
   ClientWidth     =   6030
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   6030
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton cmdCascade 
      Caption         =   "层        铺"
      Height          =   375
      Left            =   4680
      TabIndex        =   6
      Top             =   1560
      Width           =   1215
   End
   Begin VB.CommandButton cmdVertical 
      Caption         =   "水平平铺"
      Height          =   375
      Left            =   4680
      TabIndex        =   5
      Top             =   1080
      Width           =   1215
   End
   Begin VB.CommandButton cmdHorizontal 
      Caption         =   "纵向平铺"
      Height          =   375
      Left            =   4680
      TabIndex        =   4
      Top             =   600
      Width           =   1215
   End
   Begin VB.ListBox ListWindows 
      Height          =   2790
      Left            =   120
      TabIndex        =   2
      Top             =   240
      Width           =   4335
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "关        闭"
      Height          =   375
      Left            =   4680
      TabIndex        =   1
      Top             =   2040
      Width           =   1215
   End
   Begin VB.CommandButton cmdShow 
      Caption         =   "显         示"
      Height          =   375
      Left            =   4680
      TabIndex        =   0
      Top             =   120
      Width           =   1215
   End
   Begin VB.Label lblTitle 
      AutoSize        =   -1  'True
      Caption         =   "窗体列表:"
      Height          =   195
      Left            =   120
      TabIndex        =   3
      Top             =   0
      Width           =   765
   End
End
Attribute VB_Name = "frmWindows"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit
Const HWND_TOPMOST = -1
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Dim lngWindowPosition As Long
Private Declare Function SetWindowPos Lib "user32" _
         (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal Y As Long, _
          ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Private Sub cmdCascade_Click()
    MDIForm1.Arrange vbCascade
End Sub

Private Sub cmdExit_Click()
    Unload Me
End Sub

Private Sub cmdHorizontal_Click()
    MDIForm1.Arrange vbHorizontal
End Sub

Private Sub cmdShow_Click()
Dim x As Object
    For Each x In Forms
        If x.Caption + "(" + x.Name + ")" = ListWindows.Text Then
            x.SetFocus
            Exit Sub
        End If
    Next
End Sub

Private Sub cmdVertical_Click()
    MDIForm1.Arrange vbVertical
End Sub

Private Sub Form_Load()
Dim x As Object
    lngWindowPosition = SetWindowPos(Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
    For Each x In Forms
        ListWindows.AddItem x.Caption + "(" + x.Name + ")"
    Next
End Sub

⌨️ 快捷键说明

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