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

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

C#4年前 (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# 标准日期和时间格式说明符

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

C# 请确保您的 Main 函数带有 STAThreadAttribute 标记。”

System.Threading.ThreadStateException:“在可以调用 OLE 之...

C# 缩减代码量的一些方式

static void Main() { Thread thre...

C# BackgroundWorker,在DoWork里更新控件内容

一般情况下不可以直接在BackgroundWorker的DoWork事件中更新 UI 控件在Back...

C# Control防闪烁

SetStyle(ControlStyles.AllPaintingInWmPaint |...

C# Graphics图像抗锯齿

g.SmoothingMode = SmoothingMode.AntiAlia...