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

  • Thread starter Thread starter cser
  • Start date Start date
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
 
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
 
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
 
Back
Top