VS.net中鼠标读取Picture坐标问题

shuxiong_2000 2017-09-09 11:11:05
我在用VS.NET的时候遇到一点问题,我在PictureBox控件Image属性里载入图片,并用MouseUp读取当前鼠标在Picture中的坐标。当Image是我预先载入的图片时我的程序没有问题,但是当我把剪贴板的数据用Timer定时截取到Picture.Image的时候MouseUp就不能用了,请各位帮我看一下我的程序该怎么改动。
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If DispHold = False Then
My.Computer.Clipboard.Clear() : SendMessage(ctCapWin, WM_CAP_Edit_Copy, 0, 0)
End If
If My.Computer.Clipboard.ContainsImage() Then
Me.PictureBox3.Image = My.Computer.Clipboard.GetImage()
End If
End Sub

Private Sub PictureBox3_MouseUp(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.MouseEventArgs)

Dim X As Single
Dim Y As Integer

X = System.Windows.Forms.Cursor.Position.X.ToString - Location.X
Y = System.Windows.Forms.Cursor.Position.Y.ToString - Location.Y

Label2_0.Location = New Point(X, Y)
Text1.text=X & Y

End Sub



...全文
263 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
123工艺品 2017-09-15
  • 打赏
  • 举报
回复
System.Windows.Forms.Cursor.Position.X.ToString 这个是转到字符串了

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧