Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# DataGridViewCell边框颜色_C#_.net_Datagridview_Coding Style - Fatal编程技术网

C# DataGridViewCell边框颜色

C# DataGridViewCell边框颜色,c#,.net,datagridview,coding-style,C#,.net,Datagridview,Coding Style,有人知道如何在c#中更改Datagridviewcell的边框颜色吗 以下是我的意思: 背景颜色、文本颜色和颜色都没有问题,但我不知道如何实现边界 编辑:我想用winforms实现这一点 另一个问题是第二行中的十字,但这是以后的问题…您必须使用OwnerDraw自己绘制单元格才能实现这一点。您可以在datagridview上连接两个事件。”ItemCreated'和ItemDatabound'将分别向您传递一个eventarg,该eventarg可以访问您的itemtemplate。在其中,

有人知道如何在c#中更改Datagridviewcell的边框颜色吗

以下是我的意思:

背景颜色、文本颜色和颜色都没有问题,但我不知道如何实现边界

编辑:我想用winforms实现这一点


另一个问题是第二行中的十字,但这是以后的问题…

您必须使用OwnerDraw自己绘制单元格才能实现这一点。

您可以在datagridview上连接两个事件。”ItemCreated'和ItemDatabound'将分别向您传递一个eventarg,该eventarg可以访问您的itemtemplate。在其中,您可以.FindControl(“ControlId”)或单步通过.Controls集合查找单元格。一旦你得到了那个细胞,你可以做任何你想做的事情-包括边框颜色和十字架。
ItemCreated将为每个图形触发(回发),而ItemDatabound仅在数据绑定时触发:)

这是CellPaint事件