⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmdbutton.frm

📁 Visual Basic 6 大学教程的代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form cmdButton 
   Caption         =   "Fig. 12.11: Automatic Drag-and-Drop"
   ClientHeight    =   3405
   ClientLeft      =   2055
   ClientTop       =   1950
   ClientWidth     =   5205
   LinkTopic       =   "Form1"
   ScaleHeight     =   3405
   ScaleWidth      =   5205
   Begin VB.CommandButton cmdButton 
      Caption         =   "P"
      Height          =   495
      Index           =   13
      Left            =   120
      TabIndex        =   13
      Top             =   2160
      Width           =   495
   End
   Begin VB.CommandButton cmdButton 
      Caption         =   "M"
      Height          =   495
      Index           =   12
      Left            =   240
      TabIndex        =   12
      Top             =   2760
      Width           =   495
   End
   Begin VB.CommandButton cmdButton 
      Caption         =   "U"
      Height          =   495
      Index           =   11
      Left            =   1560
      TabIndex        =   11
      Top             =   2160
      Width           =   495
   End
   Begin VB.CommandButton cmdButton 
      Caption         =   "P"
      Height          =   495
      Index           =   10
      Left            =   2400
      TabIndex        =   10
      Top             =   2760
      Width           =   495
   End
   Begin VB.CommandButton cmdButton 
      Caption         =   "A"
      Height          =   495
      Index           =   9
      Left            =   960
      TabIndex        =   9
      Top             =   2760
      Width           =   495
   End
   Begin VB.CommandButton cmdButton 
      Caption         =   "O"
      Height          =   495
      Index           =   8
      Left            =   2280
      TabIndex        =   8
      Top             =   2160
      Width           =   495
   End
   Begin VB.CommandButton cmdButton 
      Caption         =   "T"
      Height          =   495
      Index           =   7
      Left            =   2880
      TabIndex        =   7
      Top             =   2160
      Width           =   495
   End
   Begin VB.CommandButton cmdButton 
      Caption         =   "I"
      Height          =   495
      Index           =   6
      Left            =   3240
      TabIndex        =   6
      Top             =   2760
      Width           =   495
   End
   Begin VB.CommandButton cmdButton 
      Caption         =   "S"
      Height          =   495
      Index           =   5
      Left            =   3600
      TabIndex        =   5
      Top             =   2160
      Width           =   495
   End
   Begin VB.CommandButton cmdButton 
      Caption         =   "R"
      Height          =   495
      Index           =   4
      Left            =   3840
      TabIndex        =   4
      Top             =   2760
      Width           =   495
   End
   Begin VB.CommandButton cmdButton 
      Caption         =   "O"
      Height          =   495
      Index           =   3
      Left            =   4200
      TabIndex        =   3
      Top             =   2160
      Width           =   495
   End
   Begin VB.CommandButton cmdButton 
      Caption         =   "N"
      Height          =   495
      Index           =   2
      Left            =   4440
      TabIndex        =   2
      Top             =   2760
      Width           =   495
   End
   Begin VB.CommandButton cmdButton 
      Caption         =   "E"
      Height          =   495
      Index           =   1
      Left            =   1680
      TabIndex        =   1
      Top             =   2760
      Width           =   495
   End
   Begin VB.CommandButton cmdButton 
      Caption         =   "O"
      Height          =   495
      Index           =   0
      Left            =   840
      TabIndex        =   0
      Top             =   2160
      Width           =   495
   End
End
Attribute VB_Name = "cmdButton"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Fig. 12.11
' Demonstrating Automatic drag-and-drop
Option Explicit         ' General declaration

Private Sub Form_Load()
   Dim a As Integer

   ' Set all DragMode properties to Automatic
   For a = cmdButton.LBound To cmdButton.UBound
      cmdButton(a).DragMode = 1    ' Automatic
   Next a
   
End Sub

Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
   Dim w As Integer, h As Integer
   
   ' Center control on mouse pointer
   w = X - Source.Width / 2
   h = Y - Source.Height / 2
   
   ' Move button to location where drop occurs
   Call Source.Move(w, h)
End Sub


⌨️ 快捷键说明

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