Jump to content
Xtreme .Net Talk

Recommended Posts

  • Leaders
Posted
If the control receives focus then you can use the LostFocus event.

 

Well... that's what I tried. The problem is that my form is full of pictureboxes, which react to mouse events, but don't take focus.

[sIGPIC]e[/sIGPIC]
  • *Experts*
Posted
One thought would be to have your form detect the mouse click then send a delegated message via a public properity to the control.

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

  • Leaders
Posted
One thought would be to have your form detect the mouse click then send a delegated message via a public properity to the control.

 

The control would need to be hidden not only when the user clicks on the form, but when he clicks on any other control, even those that can't accept focus, as well as when the user clicks anywhere outside the form.

 

I wanted my control to act very much like a context menu, in that when you click a button, it is displayed, allows him to make a selection (from a grid, thought, rather than a list of menuitems), then the control would disappear. And, like a menu, if the user clicks anywhere else on the screen, I want to hide the control and get it out of his way.

 

What I did is show a context menu with a single, owner drawn item. I do my drawing to the menuitem instead of a control, and when the user clicks, I take the mouse coordinates, and calculate where in the menu the user clicked. This method, however, gives me less control with respect to mouse events, and is less reliable.

[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...