📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "鼠标拖拽图像"
ClientHeight = 2205
ClientLeft = 60
ClientTop = 345
ClientWidth = 4095
Icon = "Form1.frx":0000
LinkTopic = "Form1"
ScaleHeight = 2205
ScaleWidth = 4095
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command1
Caption = "退出"
Height = 360
Left = 1185
TabIndex = 1
Top = 1680
Width = 1680
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
ForeColor = &H00FF0000&
Height = 360
Left = 45
TabIndex = 0
Top = 1275
Width = 2085
End
Begin VB.Image Image1
Height = 615
Left = 1035
Picture = "Form1.frx":000C
Stretch = -1 'True
Top = 120
Width = 915
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim x1 As Single
Dim y1 As Single
'开始拖动
Const begin_drag = 1
Private Sub Form_Activate()
Label1.Caption = "图片当前位置 (" & Image1.Left & "," & Image1.Top & ")"
End Sub
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Image1.Picture = Source
Form1.Image1.Picture = LoadPicture(App.Path & "\tu.jpg")
Image1.Move (X - x1), (Y - y1)
End Sub
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
x1 = X
y1 = Y
Image1.Drag begin_drag
Label1.Caption = "图片当前位置 (" & Image1.Left & "," & Image1.Top & ")"
End Sub
Private Sub Command1_Click()
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -