c# - How can I make have a custom control's click activate during design time without it first having focus? -
i have designer class custom control looks this:
public class navigationmenuitemdesigner : parentcontroldesigner { public override selectionrules selectionrules { { return selectionrules.none; } } protected override void wndproc(ref message msg) { const int wm_lbuttondown = 0x0201; const int wm_lbuttondblclk = 0x0203; if (msg.msg == wm_lbuttondown || msg.msg == wm_lbuttondblclk) { iselectionservice ss = (iselectionservice)getservice(typeof(iselectionservice)); if (ss.primaryselection navigationmenuitem) { navigationmenuitem item = (navigationmenuitem)ss.primaryselection; item.performclick(); return; } } base.wndproc(ref msg); } } when click on custom control, want performclick() method fire. works, have click on control twice. first set focus , second time activate code.
when first click on it, looks this:

then when click again, need:

any ideas on i'm doing wrong here? should not using wndproc?
you need handle control's click event, determine node cursor under , act on it. looks you're trying handle node's click event, won't fired when control doesn't have focus.
Comments
Post a Comment