0
A
回答
0
您可以在网格视图的Paint
中添加事件处理程序。
如果你想做的不仅仅是颜色,我们已经走了从DataGridViewCell
继承的路线,并覆盖其Paint方法,从DataGridViewColumn
继承使用该单元格,然后在我们的网格视图中使用该列。
下面是重写的方法,但事件hander看起来很相似。
protected override void Paint(Graphics graphics,
Rectangle clipBounds, Rectangle cellBounds,
int rowIndex, DataGridViewElementStates cellState, object value, object
formattedValue, string errorText, DataGridViewCellStyle cellStyle,
DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts
paintParts)
{
if ((value as WhatEverType).WhatEverField == 9)
{
cellStyle.ForeColor = Color.CornflowerBlue;
}
base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
}
相关问题
- 1. 更改dojo dataGrid中的行字体颜色
- 2. DataGrid行背景颜色MVVM
- 3. 更改WPF Datagrid行颜色
- 4. 更改Silverlight Datagrid中的行颜色
- 5. 在WinCE中绘制dataGrid行颜色
- 6. Vs2010字体颜色
- 7. DataGrid-CellRenderer:多种颜色的文字
- 8. 在DataGrid更改行的颜色WPF
- 9. Silverlight的DataGrid行颜色绑定
- 10. DataGrid行的条件文本颜色?
- 11. Swing:JTextPane中的字体颜色和着色颜色
- 12. JS:message.innerText字体颜色和bg颜色
- 13. ColorPicker中的TextField中的字体颜色
- 14. Safari的字体颜色
- 15. 更改备用行字体颜色
- 16. C#Silverlight Datagrid - 行颜色变化
- 17. Spark DataGrid备选行颜色更改
- 18. 如何阻止DataGrid行颜色变化?
- 19. 双击Datagrid行背景颜色变化
- 20. SQL Server Management Studio(SSMS)中使用的字体颜色(颜色)
- 21. 在运行时更改Datagrid wpf中的行的背景颜色
- 22. 如何更改UIPickerView行中各个字符的字体颜色?
- 23. 更改链接中的字体颜色
- 24. libGDX中字体的渐变颜色
- 25. 从PDFBox中获取字体的颜色
- 26. 设置选中行时WPF DataGrid行的文本颜色
- 27. 在flash中更改DataGrid的颜色cs4
- 28. localStorage更改字体颜色
- 29. Odoo Treeview颜色和字体
- 30. Eclipse Type字体颜色
我不明白。 我将创建一个类,从DataGridViewCell继承它并重写Paint ..但那么是什么? – ridermansb 2011-03-29 17:54:15
请记住,我正在开发环境Compact Framework(Windows Mobile) – ridermansb 2011-03-29 17:56:17
也许你只需要添加一个事件处理程序,但是如果你想继承,你继承了一个按你想要的方式绘制的单元格,你继承了一个使用您的单元格,并在网格视图中使用该列。可能矫枉过正的字体颜色变化,但我们也在做其他所有的事情。我不确定这对Windows Mobile是否有用。 – 2011-03-29 19:11:01