当前位置:首页 > 开发 > C# > 正文内容

C# Winform 禁止控件因方向键切换焦点

C#3年前 (2023-02-01)
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
    switch (keyData)
    {
        case Keys.Up:
        case Keys.Down:
        case Keys.Left:
        case Keys.Right:
            return true;
    }
    return base.ProcessCmdKey(ref msg, keyData);
}


转载请注明出处。

本文链接:http://www.pythonopen.com/?id=283

相关文章

C# 延时命令

方法1System.Threading.Thread.Sleep(1000);缺点:如果在主线程使用...

C# 标准日期和时间格式说明符

Code说明Write备注Y年月2022年7月y标准日期和时间格式说明符2022年7月单独使用时y年...

C# Windows环境下以管理员启动

右键点击项目名称    -   ...

在 C# 中实现类似于 Windows 资源管理器的“名称”排序方式

要在 C# 中实现类似于 Windows 资源管理器的“名称”排序方式,你需要考虑以下几点:1. 不...

C# 可空参数

using System; using System.Runtime.Inte...