Hi All,
How do i canchange font style for specific cell in datagridview?
I have this code:
================================================
private
void btStart_Click(object sender, EventArgs e)
{
int maxChanges = 3;
double maxSize = 12;
if (this.dgvText.SelectedRows.Count > 0)
{
DataGridViewCellStyle style = new DataGridViewCellStyle();
for (int i = 0; i < maxChanges; i++)
{
System.Threading.
Thread.Sleep(100);
maxSize = maxSize - 0.5;
style.Font =
new Font("Arial", (float)maxSize, FontStyle.Regular);
this.dgvText.SelectedRows[0].Cells[this.clmnText.Index].Style = style;
this.dgvText.SelectedRows[0].DefaultCellStyle = style;
}
for (int y = 0; y <= maxChanges; y++)
{
System.Threading.
Thread.Sleep(100);
maxSize = maxSize + 0.5;
style.Font =
new Font("Arial", (float)maxSize, FontStyle.Regular);
this.dgvText.SelectedRows[0].Cells[this.clmnText.Index].Style = style;
}
}
}
================================================
But this code only works well when i update the DataGridView using the following instruction after the style change instruction:
this.dgvText.SelectedRows[0].Cells[this.clmnText.Index].Style = style;
this.dgvText.Update();
Do you know any other away to update/refresh the cell style, but only forthe specific cell?
Many Thanks
Sandro Peixoto