如何在窗体中移动picturebox

[复制链接]
查看11 | 回复3 | 2011-2-17 01:10:24 | 显示全部楼层 |阅读模式
回复

使用道具 举报

千问 | 2011-2-17 01:10:24 | 显示全部楼层
<pre id=\\\"best-answer-content\\\">傻眼了吧,让你不记得写明是用C#写,你看看回答都是VB。嘿嘿~来,悬赏分给我吧
回复

使用道具 举报

千问 | 2011-2-17 01:10:24 | 显示全部楼层
<p>

<pre class=\\\"answer-content\\\">用的picturebox名字为 picture1复制到你的窗体就能用!前提你的变量不能与我的冲突
Option Explicit
Private tx As Long, ty As Long, tb As Boolean
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then \\\'如果按鼠标左键
tb = True
tx = X
ty = Y
End If
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If tb Then Picture1.Move Picture1.Left X - tx, Picture1.Top Y - ty
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
tb = False
End Sub

</p>
回复

使用道具 举报

千问 | 2011-2-17 01:10:24 | 显示全部楼层
<p>

<pre class=\\\"answer-content\\\">Private Sub picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then Picture1.Move Picture1.Left X, Picture1 Y
End Sub

</p>
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行