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:

enter image description here

then when click again, need:

enter image description here

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

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -