C#: How to suppress UserControl to give focus the first child-control? -
i have usercontrol can have childcontrol.
the usercontrol have styles:
this.setstyle( controlstyles.allpaintinginwmpaint | controlstyles.optimizeddoublebuffer | controlstyles.selectable | controlstyles.supportstransparentbackcolor | controlstyles.userpaint, true);
now if click on usercontrol (not child-control) want usercontrol keep focus, focus automatically goes first child-control. same thing happens if use tab key.
i tried override ongotfocus
without success.
any idea?
this hard-coded behavior inside usercontrol class, traps wm_setfocus message , passes focus child control. not know of way override this, trapping in wndproc() doesn't work since there no way uc base class handle it.
the best approach avoid battle , use docked panel control stand-in focusing events want uc handle. requires hacking well, panel container control, can bypassed. check out my answer here focusable panel.
Comments
Post a Comment