Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.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# 符号字体作为DataGridView中的图标_C#_Image_Datagridview_Fonts_Symbols - Fatal编程技术网

C# 符号字体作为DataGridView中的图标

C# 符号字体作为DataGridView中的图标,c#,image,datagridview,fonts,symbols,C#,Image,Datagridview,Fonts,Symbols,我知道在DataGridview中,我们可以将ImageColumn绑定到图像数据以显示图标,例如。通常我会使用微软MsoImage的图标 我突然想到,从符号字体,我们可以有许多漂亮的图标。是否可以将列绑定到文本,同时考虑字体,以便我们可以使用符号字体并显示类似图标的文本+字体的结果 如果无法进行文本绑定,是否有其他方法将符号字体提取/转换为图像?只需设置列的字体即可。下面是一个例子: List<daz> dazz = new List<daz>() { new da

我知道在DataGridview中,我们可以将ImageColumn绑定到图像数据以显示图标,例如。通常我会使用微软MsoImage的图标

我突然想到,从符号字体,我们可以有许多漂亮的图标。是否可以将列绑定到文本,同时考虑字体,以便我们可以使用符号字体并显示类似图标的文本+字体的结果


如果无法进行文本绑定,是否有其他方法将符号字体提取/转换为图像?

只需设置列的字体即可。下面是一个例子:

List<daz> dazz = new List<daz>() { new daz("♻", "267B"), new daz("⚔", "2694") };
Font f = new Font("Segue UI Symbol", 12f);
dataGridView1.DataSource = dazz;
dataGridView1.Columns[0].DefaultCellStyle.Font = f;


您可以在
DataGridViewCellStyle.Font
中设置字体。数据绑定只允许您提供字符代码,但不影响字体。。
class daz
{
    public string code { get; set; }
    public string text { get; set; }
    public daz (string c, string t) { code = c;  text = t; }
}