Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

he guyz, i need some help with graphics. am using vb.net 2003 to create an application that draws an ellipse at the point which it has been clicked on a picturebox(am using the click event of the picturebox). however i need another action to be performed once the user clicks on the ellipse. how can i be able to identify that the ellipse has been clicked on and at the same time not to fire the click event of the picturebox?

 

thanks

  • Leaders
Posted

To see if the elipse has been clicked on there are a few techniques you could use. If you are using an Image to buffer the PictureBox and you are drawing a solid ellipse, you could check the color of the pixel the user clicked on. A better option would be to store the location of the ellipse. You can use a geometric formula to determine if the point clicked is contained within the ellipse (if the ellipse is a circle, a simple distance formula would work).

 

As to the question of the click event, it sounds like you want to surpress it. To do so you would probably need to inherit the class and override the OnClick method. However, it will probably be better (and easier) to include an if statement inside the handler that only executes under desired circumstances. Instead of using the Click event, you could use the MouseDown or MouseUp events (or a combination of the two) so that you can examine the position of the mouse and decide whether or not to react (or how to react).

[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...