Click here to Skip to main content
15,882,113 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
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


I tried to apply this to the gridview but it is not working

C#
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; //Cannot implicitly convert type 'System.Windows.Forms.DataGridViewTextBoxColumn' to 'System.Drawing.Font<br>
            e.CellStyle.Font = F;
        }
Posted
Updated 7-Apr-15 1:45am
v3
Comments
Sergey Alexandrovich Kryukov 7-Apr-15 10:04am    
What is the type of "this"? I suspect you misrepresent the problem; the error message could be in response not to the code you show.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900