注册 登录
编程论坛 VB6论坛

Picture1.point(x,y)可以用,Image1.point(x,y)应该怎么写?

pel46585 发布于 2016-02-22 11:30, 4804 次点击
一个游戏,好像能检测VB生成的EXE文件中的Picturebox,只要有Picturebox的vb exe程序,游戏就会自动断线。游戏地址http://www.
为了解决这个问题,我测试了下,image控件可以使用。
下面是问题:
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Label1.Caption = Point(X, Y)
End Sub
在image的鼠标移动事件中,可以正常获得x,y点的颜色。但在Command1_Click事件中写Label1.Caption = Image1.point(x,y)就提示错误,这里应该怎么写?
不要让我改为直接用Picturebox控件,上面说过Picturebox会让游戏断线。
11 回复
#2
yangfrancis2016-02-22 18:21
mousedown事件带有坐标参数的。试试看行不。
#3
yangfrancis2016-02-22 18:26
回复 楼主 pel46585
我看错了,不是这个原因。鼠标点在按钮上又怎么获得坐标呢?按钮是在image1外面吧?
#4
pel465852016-02-22 19:08
Image1_MouseMove事件啊,x,y是自动获得的
#5
yangfrancis2016-02-22 22:36
回复 4楼 pel46585
当你鼠标跑到按钮上方时image1的mousedown事件已结束了。你怎么访问得了它的x,y?
#6
yangfrancis2016-02-22 22:38
回复 4楼 pel46585
当你鼠标跑到按钮上方时image1的mousedown事件已结束了。你怎么访问得了它的x,y?
#7
pel465852016-02-22 23:24
鼠标不在picture上,也可以picture1.point(x,y)或者form1.point(x,y)都可以获得值,只是image1.point(x,y)不行,不知道为啥
#8
风吹过b2016-02-22 23:35
image 是轻量级的图像控件,不包含画布功能,不支持任何绘图命令。
一般情况下用于提供图像源。
#9
pel465852016-02-23 00:36
可它mouse move事件上,明明可以用point啊
#10
pel465852016-02-23 00:41
回复 9楼 pel46585
查资料说object.point(x,y),,这个image不是object?那么应该怎么写?
#11
yangfrancis2016-02-23 16:20
回复 10楼 pel46585
你看能不能另外定义两个全局变量保存坐标,在mousemove事件中,将x,y的值传递给全局变量,再去访问那两个全局变量。只是个想法,我没实践过。
#12
pel465852016-02-24 10:54
知道了,在Image1_MouseMove事件中的point(x,y),其实还是Form1.Point(X,Y),实际上,Image1中的图片颜色,完全可以用Form1.Point()获得。
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Label1.Caption = Point(X, Y)
End Sub

[此贴子已经被作者于2016-2-24 11:01编辑过]

1