简体   繁体   English

在datagridview中更改组合框单元格背景

[英]changing the combobox cell background in datagridview

I have created the cell with combobox using DataGridViewComboBoxCell class in C#.But I want the combobox to look as as shown in image2.But using DataGridViewComboBoxCell the combo box appears as shown in image1.So how can we change form image1 to image2 in C# 我已经在C#中使用DataGridViewComboBoxCell类创建了带有组合框的单元格,但是我希望组合框的外观如图2所示,但是使用DataGridViewComboBoxCell组合框会如图1所示,因此我们如何在C#中将image1更改为image2 在此处输入图片说明

I think it's FlatStyle = FlatStyle.Flat you should use: 我认为这是FlatStyle = FlatStyle.Flat您应该使用:

  var col = dataGridView1.Columns[0] as DataGridViewComboBoxColumn;
 col.FlatStyle = FlatStyle.Flat;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM