我用這個代碼片斷設置DataGridViewComboBoxCell的顏色?
// Second Column: Hand to use
DataGridViewComboBoxCell handToUseCell = (DataGridViewComboBoxCell)this._robotSelectionDataGridView[Common.SECOND_COLUMN, currentRow];
handToUseCell.Items.Clear();
foreach (Hand hand in robotInfo.Hands)
{
handToUseCell.Items.Add(hand.Name.ToString());
}
handToUseCell.DisplayStyle = (handToUseCell.Items.Count > 1) ? DataGridViewComboBoxDisplayStyle.ComboBox :
DataGridViewComboBoxDisplayStyle.Nothing;
handToUseCell.Value = handToUseCell.Items[0];
handToUseCell.Style.BackColor = Color.DimGray;
但背部顏色沒有變化。當我設置cell.style.backcolor時會發生什麼?
您是否嘗試爲下拉菜單或元素(如圖所示)設置背景顏色? – 2013-04-22 10:57:34
我試圖添加backcolor到下拉菜單。 – Vidhya 2013-04-22 10:58:48
@Vidhya你試圖在Windows應用 – 2013-04-22 14:06:48