如何删除或禁用额外的列和行选择功能?

how to remove or disable the extra column and row selection function?

我有网格视图,我已经禁用了列自动宽度,所以我可以手动设置列的大小。手动调整大小后,会有一个额外的空白列。我想要的是:

  1. 当我点击 Active 中的列外部时要禁用 select 行功能,编码并生成
  2. 删除多余的列。

我已经成功地用这个事件或代码完全隐藏了剩余的列

  private void gridView1_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
    {
        if (e.Column == null)
        {
            e.Handled = true;

        }
    }

问题是我仍然可以点击类型的外部,selection 行仍然跟在我点击的地方

按以下方式处理 GridView.MouseDown 事件:

private void gridView1_MouseDown(object sender, MouseEventArgs e) {
    GridView view = (GridView)sender;
    var hi = view.CalcHitInfo(e.Location);
    Console.WriteLine(hi.HitTest);
    if (hi.InRow && !hi.InRowCell)
        DXMouseEventArgs.GetMouseArgs(e).Handled = true;
}