MouseDown event
MouseDown event
MouseDown event
MouseDown event
MouseDown event
MouseDown event MouseDown event MouseDown event MouseDown event MouseDown event MouseDown event MouseDown event MouseDown event
MouseDown event MouseDown event
MouseDown event
Go Back  Xtreme Visual Basic Talk > > > MouseDown event


Reply
 
Thread Tools Display Modes
  #1  
Old 11-17-2009, 04:00 PM
geszter geszter is offline
Newcomer
 
Join Date: Nov 2009
Posts: 1
Default MouseDown event


Hi!

I wrote a game in VB, I used a table with images. I want to do: when it's right click i want to change the image. But how can I get which image was that?
Thanks!

the code is:

Dim table(20, 20) As PictureBox

Private Sub PnTabla_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PnTabla.MouseDown
If e.Button = Windows.Forms.MouseButtons.Right Then
table(? ?).Image = New Bitmap("pressed.jpg")
End If
Reply With Quote
  #2  
Old 11-17-2009, 07:58 PM
Iceplug's Avatar
IceplugMouseDown event Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

Why don't you set up a MouseDown event that handles the Picturebox mousedown event for all of the pictureboxes on the table. Then, the sender should be able to tell you the picturebox that was clicked.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #3  
Old 11-20-2009, 05:03 PM
Iceplug's Avatar
IceplugMouseDown event Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

I'm not sure if you've got the control array implemented, but here is my article on control arrays if you don't have it implemented.
Control Arrays in .NET
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
MouseDown event
MouseDown event
MouseDown event MouseDown event
MouseDown event
MouseDown event
MouseDown event MouseDown event MouseDown event MouseDown event MouseDown event MouseDown event MouseDown event
MouseDown event
MouseDown event
 
MouseDown event
MouseDown event
 
-->