Inheritance: System.ComponentModel.Component, IExtenderProvider
コード例 #1
0
        private const int attrCount = 4; // This constant returns number of BlogTags(Class) sub-arrays item count [like: tag, tagText, tooltipTitle, tooltipText]

        #endregion Fields

        #region Methods

        public static void importAllAutoCompleteItems(AutocompleteMenu autoCMPControl)
        {
            // Adding [ appEngine.BlogTags.SingleTags ] to AutoComplete
            for (int iX = 0; iX < ((BlogTags.SingleTags.Length) / attrCount); iX++)
            {
                autoCMPControl.AddItem(CreateOne(BlogTags.SingleTags[iX, 0].ToString(), BlogTags.SingleTags[iX, 1].ToString(), BlogTags.SingleTags[iX, 2].ToString(), BlogTags.SingleTags[iX, 3].ToString(), 0));

            }
            // Adding [ appEngine.BlogTags.SingleAttribute ] to AutoComplete
            for (int iX = 0; iX < ((BlogTags.SingleAttributes.Length) / attrCount); iX++)
            {
                autoCMPControl.AddItem(CreateOne(BlogTags.SingleAttributes[iX, 0], BlogTags.SingleAttributes[iX, 1], BlogTags.SingleAttributes[iX, 2], BlogTags.SingleAttributes[iX, 3], 1));
            }

            // Adding [ appEngine.BlogTags.BoxBasedTags ] to AutoComplete
            for (int iX = 0; iX < ((BlogTags.BoxBasedTags.Length) / attrCount); iX++)
            {
                autoCMPControl.AddItem(CreateOne(BlogTags.BoxBasedTags[iX, 0], BlogTags.BoxBasedTags[iX, 1], BlogTags.BoxBasedTags[iX, 2], BlogTags.BoxBasedTags[iX, 3], 2));
            }

            // Adding [ appEngine.BlogTags.ViewBasedTags ] to AutoComplete
            for (int iX = 0; iX < ((BlogTags.ViewBasedTags.Length) / attrCount); iX++)
            {
                autoCMPControl.AddItem(CreateOne(BlogTags.ViewBasedTags[iX, 0], BlogTags.ViewBasedTags[iX, 1], BlogTags.ViewBasedTags[iX, 2], BlogTags.ViewBasedTags[iX, 3], 3));
            }
        }
コード例 #2
0
        public AutocompleteMenuHost(AutocompleteMenu menu)
        {
            AutoClose = false;
            AutoSize = false;
            Margin = Padding.Empty;
            Padding = Padding.Empty;

            Menu = menu;
            ListView = new AutocompleteListView();
        }
コード例 #3
0
 public void SetAutocompleteMenu(Control control, AutocompleteMenu menu)
 {
     if (menu != null)
     {
         if (WrapperByControls.ContainsKey(control))
         {
             var wrapper = WrapperByControls[control];
             if (wrapper == null) return;
             //
             if (control.IsHandleCreated)
                 menu.SubscribeForm(wrapper);
             else
                 control.HandleCreated += (o, e) => menu.SubscribeForm(wrapper);
             //
             AutocompleteMenuByControls[control] = this;
             //
             wrapper.LostFocus += menu.control_LostFocus;
             wrapper.Scroll += menu.control_Scroll;
             wrapper.KeyDown += menu.control_KeyDown;
             wrapper.MouseDown += menu.control_MouseDown;
         }
         else
         {
             var wrapper = menu.CreateWrapper(control);
             if (wrapper == null) return;
             //
             if (control.IsHandleCreated)
                 menu.SubscribeForm(wrapper);
             else
                 control.HandleCreated += (o, e) => menu.SubscribeForm(wrapper);
             //
             AutocompleteMenuByControls[control] = this;
             //
             wrapper.LostFocus += menu.control_LostFocus;
             wrapper.Scroll += menu.control_Scroll;
             wrapper.KeyDown += menu.control_KeyDown;
             wrapper.MouseDown += menu.control_MouseDown;
         }
     }
     else
     {
         AutocompleteMenuByControls.TryGetValue(control, out menu);
         AutocompleteMenuByControls.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;
         }
     }
 }
コード例 #4
0
 private static void SetAutoComplete(IEnumerable<AutocompleteItem> items, AutocompleteMenu completemenu,
     Control tb)
 {
     completemenu.SetAutocompleteMenu(tb, completemenu);
     completemenu.SetAutocompleteItems(items);
 }
コード例 #5
0
 public void SetAutocompleteMenu(Control control, AutocompleteMenu menu)
 {
     if (menu != null)
     {
         if (WrapperByControls.ContainsKey(control))
         {
             var wrapper = WrapperByControls[control];
             if (wrapper == null)
             {
                 return;
             }
             //
             if (control.IsHandleCreated)
             {
                 menu.SubscribeForm(wrapper);
             }
             else
             {
                 control.HandleCreated += (o, e) => menu.SubscribeForm(wrapper);
             }
             //
             AutocompleteMenuByControls[control] = this;
             //
             wrapper.LostFocus += menu.control_LostFocus;
             wrapper.Scroll    += menu.control_Scroll;
             wrapper.KeyDown   += menu.control_KeyDown;
             wrapper.MouseDown += menu.control_MouseDown;
         }
         else
         {
             var wrapper = menu.CreateWrapper(control);
             if (wrapper == null)
             {
                 return;
             }
             //
             if (control.IsHandleCreated)
             {
                 menu.SubscribeForm(wrapper);
             }
             else
             {
                 control.HandleCreated += (o, e) => menu.SubscribeForm(wrapper);
             }
             //
             AutocompleteMenuByControls[control] = this;
             //
             wrapper.LostFocus += menu.control_LostFocus;
             wrapper.Scroll    += menu.control_Scroll;
             wrapper.KeyDown   += menu.control_KeyDown;
             wrapper.MouseDown += menu.control_MouseDown;
         }
     }
     else
     {
         AutocompleteMenuByControls.TryGetValue(control, out menu);
         AutocompleteMenuByControls.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;
         }
     }
 }