about Focus

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,all

I have a control ,when the control gets foucs.
I do not want to lost focus unless this control release focus by self.

How to do it?

thanks
 
Capture the lostFocus event of the control and use a bool flag to see if the control should lose focus or not. For example:

private void Control_LostFocus(object sender, System.EventArgs e)
{
if(!loseFocus)
((Control)sender).Focus();
}

You will have to manage the bool (loseFocus) throughout your code.
 
Back
Top