简体   繁体   English

C# 更改数据网格视图的特定行字体

[英]C# Change Specific Row Font of Data Grid View

I tried to change font with this code: dataGridView1.Rows[0].DefaultCellStyle.Font = new Font("Arial", 12, FontStyle.Bold);我尝试使用以下代码更改字体: dataGridView1.Rows[0].DefaultCellStyle.Font = new Font("Arial", 12, FontStyle.Bold);

This didn't work, only way font would change was by changing RowTemplate.DefaultCellStyle.Font.这不起作用,改变字体的唯一方法是改变 RowTemplate.DefaultCellStyle.Font。 I guess Row Template overrides my changes.我猜 Row Template 会覆盖我的更改。 I was also trying to change font in Form's constructor.我还试图在 Form 的构造函数中更改字体。 extra info: row and column headers visibility are set to false and user is not allowed to add more rows or delete or resize.额外信息:行和列标题可见性设置为 false,并且不允许用户添加更多行或删除或调整大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM