예제 #1
0
        public codesenseHost(codesense menu)
        {
            AutoClose = false;
            AutoSize  = false;
            Margin    = Padding.Empty;
            Padding   = Padding.Empty;

            Menu     = menu;
            ListView = AlistView;
        }
예제 #2
0
 public void SetCodeSense(Control control, codesense menu)
 {
     if (menu != null)
     {
         if (WrapperByControls.ContainsKey(control))
         {
             return;
         }
         var wrapper = menu.CreateWrapper(control);
         if (wrapper == null)
         {
             return;
         }
         //
         if (control.IsHandleCreated)
         {
             menu.SubscribeForm(wrapper);
         }
         else
         {
             control.HandleCreated += (o, e) => menu.SubscribeForm(wrapper);
         }
         //
         CodeSenseByControls[control] = this;
         //
         wrapper.LostFocus += menu.control_LostFocus;
         wrapper.Scroll    += menu.control_Scroll;
         wrapper.KeyDown   += menu.control_KeyDown;
         wrapper.MouseDown += menu.control_MouseDown;
     }
     else
     {
         CodeSenseByControls.TryGetValue(control, out menu);
         CodeSenseByControls.Remove(control);
         ITextBoxWrapper wrapper = null;
         WrapperByControls.TryGetValue(control, out wrapper);
         WrapperByControls.Remove(control);
         if (wrapper != null && menu != null)
         {
             wrapper.LostFocus -= menu.control_LostFocus;
             wrapper.Scroll    -= menu.control_Scroll;
             wrapper.KeyDown   -= menu.control_KeyDown;
             wrapper.MouseDown -= menu.control_MouseDown;
         }
     }
 }