Change inheritance at design time?

G

Guest

This is bizarre, but is there any way to inherit from one control at design
time but from another at run time? Something like this:

#if <some design time indicator>
public class UserControl1 : System.Windows.Forms.UserControl
#else
public class UserControl1 : System.Windows.Forms.Control
#endif

I’m really just looking for some solution to a defect, where a mdi child
form with a UserControl on it has problems remembering focus when switching
to another mdi child form and back. Any ideas on how to deal with that would
be appreciated.
Gary
 
S

Sanjeevakumar Hiremath

Save the Control.Handle in your form and while switching back just
Control.FromHandle(handle).Focus().
Hope this is helpful.
 
G

Guest

How does this differ from just calling Focus() on the control? The real
problem I'm trying to solve is that a MDI child form that has a UserControl
won't remember that the UserControl had focus when switching to another form
and back. Microsoft has verified this but has no plans to fix it.

Thanks for your assistance,
Gary
 

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