2011-11-11 34 views
0
' Show game directions. 
        ShowGameObjective() 

        ' Press any cursor key to skip instructions. 
        If ButtonEasy = True Then 
          Gamemode = 1 
        ElseIf ButtonMedium = Clicked Then 

        End If 

如何查看图像是否已被直接点击?例如:我有三个图像(system.drawing.bitmap)在我的图形缓冲区;简单,中等和困难。在上面的代码中,如果ButtonEasy图像被点击,它将设置Gamemode的整数为“1”,依此类推,取决于所点击的图像。如何查看通过graphic.drawimage绘制成形的图像是否已被点击?

我觉得这实际上很容易做,因为它没有记录在这里或MSDN。

在此先感谢!

编辑:思考一些后,会有这样的工作?

Private Sub ButtonEasy_OnMouseClick ... GameMode=1 End Sub

回答

1

在鼠标点击事件处理程序,你可以这样做:

Dim buttonRect = New Rectangle(50, 20, 100, 100) 
If buttonRect.Contains(e.Location) Then ... 
1

处理的MouseClick事件,并检查其中e.Location是。

+0

正如上点击鼠标,检查鼠标点击和交叉引用它与图像的位置的位置? –

+0

准确 – SLaks

+0

或不想:Private Sub ButtonEasy_OnMouseClick ...,然后设置事件来设置GameMode = x –

相关问题