我发送了我的datagridview字体,名为' dgr_Operations'到Calibri 9号。
加载我的用户表单后,我调用下面描述的createDataGridStyles方法。
private void Frm_Dialog_Solde_Comptes_Load(object sender, EventArgs e)
{
try
{
createDataGridStyles();
this.CenterToScreen();
}
catch (Exception exc)
{
ClsErrorManager.manageException(exc);
}
finally
{
}
}
private void createDataGridStyles()
{
try
{
this.m_DataGridViewCellStyleIntro = new DataGridViewCellStyle();
this.m_DataGridViewCellStyleIntro.Font = new Font(this.dgr_Operations.Font, FontStyle.Bold);
this.m_DataGridViewCellStyleIntro.ForeColor = Color.Blue;
}
catch (Exception exc)
{
ClsErrorManager.manageException(exc);
}
finally
{
}
}
当我尝试应用样式时,单元格似乎没有在Calibri 9中格式化:
for (int m = 0; m < this.dgr_Operations.Rows.Count; m++)
{
l_CellValue1 = this.dgr_Operations[0, m].Value.ToString();
switch (l_CellValue1)
{
case "EN":
// this.dgr_Operations[1, m].Style.ForeColor = Color.Blue;
// this.dgr_Operations[1, m].Style.Font.Bold = FontStyle.Bold;
this.dgr_Operations[1, m].Style = m_DataGridViewCellStyleIntro;
break;
// [...]
你知道我错过了什么吗?