我的代碼是:Style.ForeColor未在Windows正常工作7
grdListofItems.Rows[intRow].Cells[columnName].Style.ForeColor = Color.Green;
它工作正常,在Windows經典模式和DropDownList
字體爲綠色。
但是,當它在Windows 7中運行時,字體顏色會變回黑色。
我的代碼是:Style.ForeColor未在Windows正常工作7
grdListofItems.Rows[intRow].Cells[columnName].Style.ForeColor = Color.Green;
它工作正常,在Windows經典模式和DropDownList
字體爲綠色。
但是,當它在Windows 7中運行時,字體顏色會變回黑色。
嘗試啓用Application.EnableVisualStyles();
。 順便說一下,你的意思是一個ComboBox
或DataGridView
?
編輯:此鏈接導致答案。 Change the back color of the cell for DataGridViewComboBoxColumn
它仍然是相同的人.. –
如果它是一個組合框:http://stackoverflow.com/questions/4667532/colour-individual-items-in-a-winforms-combobox 如果這是一個DataGridView:我試了一下,它的工作原理... – Essigwurst
DataGridViewComboBoxColumn –
@ zx485感謝的人 –