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

📄 frmdragdrop.frm

📁 适合乡镇供电所使用电费处理系统v3 软件
💻 FRM
字号:
VERSION 5.00
Begin VB.Form FrmDragDrop 
   Caption         =   "Form1"
   ClientHeight    =   4980
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7110
   LinkTopic       =   "Form1"
   ScaleHeight     =   4980
   ScaleWidth      =   7110
   StartUpPosition =   3  '窗口缺省
   Begin VB.PictureBox Picture3 
      Height          =   1605
      Left            =   2085
      Picture         =   "FrmDragDrop.frx":0000
      ScaleHeight     =   1545
      ScaleWidth      =   2100
      TabIndex        =   6
      Top             =   2925
      Width           =   2160
   End
   Begin VB.PictureBox Picture2 
      DragMode        =   1  'Automatic
      Height          =   1650
      Left            =   45
      Picture         =   "FrmDragDrop.frx":018A
      ScaleHeight     =   1590
      ScaleWidth      =   1665
      TabIndex        =   5
      Top             =   2130
      Width           =   1725
   End
   Begin VB.DriveListBox Drive1 
      Height          =   300
      Left            =   2055
      TabIndex        =   4
      Top             =   765
      Width           =   2475
   End
   Begin VB.DirListBox Dir1 
      Height          =   1560
      Left            =   2070
      TabIndex        =   3
      Top             =   1125
      Width           =   2475
   End
   Begin VB.FileListBox File1 
      Height          =   1890
      Left            =   4695
      TabIndex        =   2
      Top             =   780
      Width           =   2280
   End
   Begin VB.PictureBox Picture1 
      DragMode        =   1  'Automatic
      Height          =   1560
      Left            =   120
      ScaleHeight     =   1500
      ScaleWidth      =   1620
      TabIndex        =   0
      Top             =   210
      Width           =   1680
   End
   Begin VB.Label Label1 
      Caption         =   "Label1"
      Height          =   195
      Left            =   3150
      TabIndex        =   1
      Top             =   300
      Width           =   2205
   End
End
Attribute VB_Name = "FrmDragDrop"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Form_Load()
   Picture1.AutoSize = -1   ' 打开 AutoSize。
   Label1.Visible = 0   ' 使该标签不可见。
   File1.Pattern = "*.BMP; *.ICO; *.WMF"   ' 设置文件的各种样式。
End Sub

Private Sub Dir1_Change()    ' 任何 Dir1 中的变更
   File1.Path = Dir1.Path   ' 都显示在 ile1 中。
End Sub

Private Sub Drive1_Change()    ' 任何 Drive1 中的变更
   Dir1.Path = Drive1.Drive   ' 都显示在 Dir1 中。
End Sub

Private Sub File1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
   Dim DY   ' 声明变量。
   DY = TextHeight("A")   ' 取得一行的高度。
   Label1.Move File1.Left, File1.Top + Y - DY / 2, File1.Width, DY
   Label1.Drag   ' 拖标签轮廓。
End Sub

Private Sub Dir1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
   ' 改变指针为不放。
   If State = 0 Then Source.MousePointer = 12
   ' 使用缺省鼠标指针。
   If State = 1 Then Source.MousePointer = 0
End Sub

Private Sub Drive1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
   ' 改变指针为不放。
   If State = 0 Then Source.MousePointer = 12
   ' 使用缺省鼠标指针。
   If State = 1 Then Source.MousePointer = 0
End Sub
Private Sub Form_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
   ' 改变指针为不放。
   If State = 0 Then Source.MousePointer = 12
   ' 使用缺省鼠标指针。
   If State = 1 Then Source.MousePointer = 0
End Sub

Private Sub File1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
   On Error Resume Next
   If State = 0 And Right$(File1.Filename, 4) = ".ICO" Then
      Label1.DragIcon = LoadPicture(File1.Path + "\" + File1.Filename)
   If Err Then MsgBox "The icon file can't be loaded."
   ElseIf State = 1 Then
      Label1.DragIcon = LoadPicture()    ' 使用非拖式图标。
   End If
End Sub

Private Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single)
   On Error Resume Next
   Picture1.Picture = LoadPicture(File1.Path + "\" + File1.Filename)
   If Err Then MsgBox "The picture file can't be loaded."
   Source.DragIcon = LoadPicture()   ' 卸载图标。
End Sub



Private Sub Picture2_DragDrop(Source As Control, X As Single, Y As Single)
   If TypeOf Source Is PictureBox Then
      ' 将 Picture3 位图设置为与源控件相同。
      Picture2.Picture = Source.Picture
   End If

End Sub

Private Sub Picture3_DragDrop(Source As Control, X As Single, Y As Single)
   If TypeOf Source Is PictureBox Then
      ' 将 Picture3 位图设置为与源控件相同。
      Picture3.Picture = Source.Picture
   End If
End Sub


Private Sub Picture1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
   Select Case State
      Case vbEnter
   ' 装载图标。
         Source.DragIcon = LoadPicture("e:\Program Files\Microsoft Visual Studio\Common\Graphics\Icons\Arrows\point02.ico")
      Case vbLeave
         Source.DragIcon = LoadPicture()   ' 卸载图标.
   End Select
End Sub


⌨️ 快捷键说明

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