如何为datagridview中的不同列赋予不同的字体大小 [英] how to give different font size to different columns in a datagridview

查看:300
本文介绍了如何为datagridview中的不同列赋予不同的字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为datagridview中的不同列赋予不同的字体大小(属性中已经设置了默认单元格样式).但我需要为不同的列使用不同的字体大小.

在此先感谢

how to give different font size to different columns in a datagridview(default cell style has been already set in properties). but I need different font size for different column.

thanks in advance

推荐答案

我认为您需要在代码中完成此操作?

这可能无济于事:您可能还需要调整行高,因为更改单元格字体大小不会对此造成影响.
I assume you need this done in code?

This may not help a lot: you may have to tweak the row heights as well, as altering the cell font size does not affect that.
private void SetColumns()
    {
    float current = 5.0F;
    foreach (DataGridViewColumn col in myDataGridView.Columns)
        {
        col.DefaultCellStyle.Font = new Font("Verdana", current);
        current += 5.0F;
        }
    }


这篇关于如何为datagridview中的不同列赋予不同的字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆