Windows Mobile 6 - 在 WinForms 文本框上禁用自动完成 [英] Windows Mobile 6 - Disable AutoComplete on WinForms TextBoxes

查看:13
本文介绍了Windows Mobile 6 - 在 WinForms 文本框上禁用自动完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个 windows mobile 6 应用程序,我需要在表单上的文本框上禁用自动完成功能.信息正在被扫描到其中,因此我需要禁用自动完成/自动建议功能.我可以以编程方式执行此操作还是需要操作注册表项?(这不是商业应用.)

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 to disable the autocomplete/autosuggest feature. Can I do this programmatically or do I need to manipulate registry keys? (This is not a commercial application.)

推荐答案

使用该类,它将调用 SHSetInputContext 方法并禁用启用控件的悬停事件.只需通过控件 Handle.

Use this class, it will pinvoke the SHSetInputContext method and disableenable 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);
    }
}

示例:

InputContext.SetAutoSuggestion(txtBoxOne.Handle, false);

这篇关于Windows Mobile 6 - 在 WinForms 文本框上禁用自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆