How to hide a control when mouse click is out of its rectangle?

C

cser

Hi all,

I have a custom control which I have to hide when mouse clicks outside of
its client rectangle.
I have tried to use the timer control, which reads periodically
Control.MousePosition and deal if the click was out- or inside of the
control's rectangle. But I feel this is not the best solution. And there's a
problem with this: when I click tabcontrol's tabpage selector it does not
change the mouse position, so I cannot detect that mouseclick, and my
control stay visible. LostFocus event also doesn't work at not "input
control" clicks.
There is a good example: the combobox control. It works well (it can hide
its listbox) . But how does it work?
So any help?
Thanx
Cser
 
C

cser

Thanx, but it did not fix my problem.
The mousemove event is NOT fired when I click outside of my control :(
(So in the example on Gotdotnet.com I cannot change my control's color back
to gray!)

Cser
 
A

Alex Yakhnin [MVP]

It's been working fine for me.

-Alex


cser said:
Thanx, but it did not fix my problem.
The mousemove event is NOT fired when I click outside of my control :(
(So in the example on Gotdotnet.com I cannot change my control's color back
to gray!)

Cser
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top