首页 > 解决方案 > 在带有 RadioButtons 的 UserControl 表单中按下导航键后表单没有响应

问题描述

我面临着“箭头键和更改控件的焦点挂起应用程序”中提出的相同问题。由于我没有足够的积分,我无法对此发表评论。因此,我发布了一个新的。

提前致谢。

  1. 运行程序
  2. 选择任何单选按钮
  3. 点击按钮2
  4. 按 T​​ab 将焦点放在单选按钮上
  5. 按左/右导航键
  6. 形成挂断(不响应)。

Form1.cs

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void button2_Click(object sender, EventArgs e)
    {
        ucPage11.BringToFront();
        ucPage11.Enabled = true;
        richTextBox1.Enabled = false; 
    }

    private void ucPage11_SelectionChanged()
    {
        ucPage11.Enabled = false;
        richTextBox1.BringToFront();
        richTextBox1.Enabled = true;
    }
}

UserControl.cs - 用户控件中有 3 个单选按钮控件。

public delegate void SelectionEventHandler();

public partial class UCPage1 : UserControl
{
    //private ToggleImageControlManager toggleImgCtrlMgr;

    public UCPage1()
    {
        this.InitializeComponent();
    }

    public event SelectionEventHandler SelectionChanged;

    private void RBO_Click(object sender, EventArgs e)
    {
        SelectionChanged?.Invoke();
    }
}

标签: c#winforms

解决方案


推荐阅读