1
Reply

How to Increase/Change font size from using combo box

Enos

Enos

Apr 7 2015 7:33 AM
1.3k
I have a gridview with five columns. from the second gridview cells I have a column called font size which I have used combo-box and give static numbers like (2.4.6.8.10).
The purpose of font size is, when you select any number from the combo box, it must change the font size text for that row.
I have created a combo-box and a label which I will select the font size and the label will change the text size according to the selected size. I am falling to apply this to the datagridview where it will change the whole cells for that row
code
I tried to apply this to the gridview but it is not working
Dictionary<int, Font> rowFont = new Dictionary<int, Font>();
public void selectedRowsFont(Font F)
{
foreach(DataGridViewRow row in Gridview_Output.SelectedRows)
{
rowFont[row.Index] = F;
}
}
private void Gridview_Output_CellFormatting_1(object sender, DataGridViewCellFormattingEventArgs e)
{
Font F = null;
if (!rowFont.TryGetValue(e.RowIndex, out F))
F = this.Font; //Error : Cannot implicitly convert type 'System.Windows.Forms.DataGridViewTextBoxColumn' to 'System.Drawing.Font
e.CellStyle.Font = F;
}

Answers (1)