Windows Mobile 6 - Disable AutoComplete on WinForms TextBoxes

后端 未结 1 1731
花落未央
花落未央 2020-12-16 07:38

I am making a windows mobile 6 app, where I need to disable autocomplete on the textboxes that I have on my form. Information is being scanned into them, therefore I need t

相关标签:
1条回答
  • 2020-12-16 07:59

    Use this class, it will pinvoke the SHSetInputContext method and disable\enable the hover over events for the controls. Simply pass the controls Handle.

    public static class InputContext
    {
        private enum SHIC_FEATURE : uint
        {
            RESTOREDEFAULT = 0,
            AUTOCORRECT = 1,
            AUTOSUGGEST = 2,
            HAVETRAILER = 3,
            CLASS = 4
        }
    
        [DllImport("aygshell.dll")]
        private static extern int SHSetInputContext(IntPtr hwnd, SHIC_FEATURE dwFeature, ref bool lpValue);
    
        public static void SetAutoSuggestion(IntPtr handle, bool enable)
        {
            SHSetInputContext(handle, SHIC_FEATURE.AUTOSUGGEST, ref enable);
            SHSetInputContext(handle, SHIC_FEATURE.AUTOCORRECT, ref enable);
        }
    }
    

    Example:

    InputContext.SetAutoSuggestion(txtBoxOne.Handle, false);
    
    0 讨论(0)
提交回复
热议问题