【发布时间】:2016-08-10 23:02:20
【问题描述】:
为什么行中没有文本? 如何使行中的文本加粗?
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.dataGridView1.AutoGenerateColumns = false;
this.dataGridView1.Columns.Add(new DataGridViewColumn { HeaderText = "Test", CellTemplate = new DataGridViewTextBoxCell() { }, DefaultCellStyle = new DataGridViewCellStyle { Font = new Font("Tahoma", 9.75F, FontStyle.Bold) } });
this.dataGridView1.DataSource = new List<Employee>
{
new Employee {Name="Test"},
new Employee {Name="Test"},
new Employee {Name="Test"},
new Employee {Name="Test"},
new Employee {Name="Test"},
new Employee {Name="Test"},
new Employee {Name="Test"}
};
}
}
public class Employee
{
public string Name { get; set; }
public int Number { get; set; }
}
}
【问题讨论】:
标签: c# winforms datagridview