Winforms DataGridViewComboxColumn在Windows 7上的行为不同;操作系统

Winforms DataGridViewComboxColumn在Windows 7上的行为不同;操作系统,winforms,datagridviewcombobox,datagridviewcomboboxcell,Winforms,Datagridviewcombobox,Datagridviewcomboboxcell,我已经在Windows窗体中创建了一个客户端应用程序。我使用Windows Server 2008 R2进行开发 然而,当我在Windows7或10上部署相同的解决方案时,客户端报告了一些我无法在我的机器上重现的错误。它给了我不同的结果 到目前为止,我有两个问题: DataGridViewComboBoxColumn背景色变成灰色 当使用制表符或光标键在列之间移动时,它们跳过组合框列这是最大的问题。 我已经用最少的代码创建了一个测试应用程序,并且发现这个问题在测试应用程序中仍然存在 DataGr

我已经在Windows窗体中创建了一个客户端应用程序。我使用Windows Server 2008 R2进行开发

然而,当我在Windows7或10上部署相同的解决方案时,客户端报告了一些我无法在我的机器上重现的错误。它给了我不同的结果

到目前为止,我有两个问题:

  • DataGridViewComboBoxColumn
    背景色变成灰色
  • 当使用制表符或光标键在列之间移动时,它们跳过组合框列这是最大的问题。
  • 我已经用最少的代码创建了一个测试应用程序,并且发现这个问题在测试应用程序中仍然存在

    DataGridViewComboBoxColumn column = new DataGridViewComboBoxColumn();
    {
        column.HeaderText = "CB";
        column.Name = "CB";
        column.DefaultCellStyle.BackColor = Color.White;
        //column.CellTemplate = new DataGridViewCheckBoxCell();
        column.DataSource = list;
        column.ValueType = typeof(string);
    
    }
    
    dataGridView1.Columns.Add(column);
    
    dataGridView1.DataSource = dtEmp;
    
    以下是问题的屏幕截图:

    Windows 10-请注意,尽管移动了光标键,但第一列并没有突出显示

    Windows 2008-请注意,第一列高亮显示,单元格未灰显。

    任何帮助都将不胜感激。

    您可以尝试将属性更改为
    Nothing
    枚举值,这样您的列将按样式显示,并且焦点将可见。不过,组合框箭头显然会消失,但这对您来说可能不是问题

    this.Column1.DisplayStyle = System.Windows.Forms.DataGridViewComboBoxDisplayStyle.Nothing;
    

    或者尝试将属性更改为“平面”,这样您将看到一个组合框箭头:

    this.Column1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
    

    谢谢。这就像一个符咒:This.Column1.FlatStyle=System.Windows.Forms.FlatStyle.Flat;