Windows Mobile 6 - 禁用 WinForms 文本框上的自动完成功能

发布于 2024-10-09 11:02:18 字数 122 浏览 0 评论 0原文

我正在制作一个 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.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

叫嚣ゝ 2024-10-16 11:02:18

使用此类,它将调用 SHSetInputContext 方法并禁用/启用控件的悬停事件。只需传递控件句柄即可。

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);

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);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文