コード例 #1
0
        /// <summary>Sets a custom automatic complete list.</summary>
        /// <param name="textBox">The text box.</param>
        /// <param name="items">The autocomplete strings.</param>
        /// <param name="options">The autocomplete options.</param>
        public static void SetCustomAutoCompleteList(this TextBox textBox, IList <string> items, AUTOCOMPLETEOPTIONS options = AUTOCOMPLETEOPTIONS.ACO_AUTOSUGGEST)
        {
            var ac = new IAutoComplete2();

            ac.Init(textBox.Handle, new ComEnumStringImpl(items), null, null);
            ac.SetOptions(options);
        }
コード例 #2
0
 protected override void CreateHandle()
 {
     base.CreateHandle();
     autoComplete         = (IAutoComplete2) new IAutoComplete();
     autoCompleteDropDown = (IAutoCompleteDropDown)autoComplete;
     autoComplete.SetOptions(AutoCompleteOptions.AutoSuggest);
     autoComplete.Init(new HandleRef(this, this.Handle), new EnumString(new string[] { "Administrator", "Clerk" }), null, null);
 }
コード例 #3
0
 void ReleaseAutoComplete()
 {
     if (autoComplete != null)
     {
         Marshal.ReleaseComObject(autoComplete);
         autoComplete         = null;
         autoCompleteDropDown = null;
     }
 }
コード例 #4
0
        public static void Disable(IntPtr controlHandle)
        {
            if (controlHandle == IntPtr.Zero)
            {
                return;
            }

            IAutoComplete2 iac = null;

            try
            {
                iac = (IAutoComplete2)GetAutoComplete();
                iac.Enable(false);
            }
            finally
            {
                if (iac != null)
                {
                    Marshal.ReleaseComObject(iac);
                }
            }
        }
コード例 #5
0
ファイル: ShellAutoComplete.cs プロジェクト: Ytrog/RssBandit
        /// <summary>
        /// Enable/Disable auto complete.
        /// </summary>
        /// <param name="enable">bool</param>
        /// <param name="quickComplete">string. Use null to disable CTRL-ENTER handling</param>
        /// <remarks>CTRL-ENTER seems to have a bug: it also expands already expanded Urls of the form 'http://xyz.domain'</remarks>
        public void SetAutoComplete(Boolean enable, string quickComplete)
        {
            Int32          ret;
            IAutoComplete2 iac2 = (IAutoComplete2)GetAutoComplete();

            if (EditHandle == IntPtr.Zero)
            {
                throw new Exception("EditHandle must not be zero!");
            }

            if (ListSource == null)
            {
                throw new Exception("ListSource must not be null!");
            }

            ret = iac2.Init(EditHandle, ListSource, "", quickComplete);

            ret = iac2.SetOptions((UInt32)ACOptions);

            ret = iac2.Enable(enable ? 1 : 0);

            Marshal.ReleaseComObject(iac2);
        }
コード例 #6
0
        public static void Enable(IntPtr controlHandle, SourceCustomList items, AUTOCOMPLETEOPTIONS options)
        {
            if (controlHandle == IntPtr.Zero)
            {
                return;
            }

            IAutoComplete2 iac = null;

            try
            {
                iac = (IAutoComplete2)GetAutoComplete();
                int ret = iac.Init(controlHandle, items, "", "");
                ret = iac.SetOptions(options);
                ret = iac.Enable(true);
            }
            finally
            {
                if (iac != null)
                {
                    Marshal.ReleaseComObject(iac);
                }
            }
        }