Tag: 所有者

C#ListView详细信息,突出显示单个单元格

我在C#中使用ListView来制作网格。 我想找到一种能够以编程方式突出显示特定单元格的方法。 我只需要突出显示一个单元格。 我已经尝试了所有者绘制的子项目,但使用下面的代码,我得到突出显示的单元格,但没有文字! 有没有关于如何使这个工作的想法? 谢谢你的帮助。 //m_PC.Location is the X,Y coordinates of the highlighted cell. void listView1_DrawSubItem(object sender, DrawListViewSubItemEventArgs e) { if ((e.ItemIndex == m_PC.Location.Y) && (e.Item.SubItems.IndexOf(e.SubItem) == m_PC.Location.X)) e.SubItem.BackColor = Color.Blue; else e.SubItem.BackColor = Color.White; e.DrawBackground(); e.DrawText(); }