none
Error While trying using font dialog RRS feed

  • Question

  • I using a worksheet control as a grid, i try to using font dialog to change worksheet font as my desire 

    this is my code

     private void toolStripButton5_Click(object sender, EventArgs e)
            {
                FontDialog fdl = new FontDialog();
                if (fdl.ShowDialog()== DialogResult.OK)
                {
                    var worksheet = reoGridControl1.CurrentWorksheet;
                    reoGridControl1.DoAction(new SetRangeStyleAction(worksheet.SelectionRange, new WorksheetRangeStyle
                    {
                        Flag =PlainStyleFlag.FontAll,
                        FontSize=fdl.Font,
                    }));
                } 
            }

    But it apear to be an error

    Cannot implicitly convert type 'System.Drawing.Font' to 'float'.

    Can anyone help me, thank u.


    Monday, September 17, 2018 3:55 AM

Answers

  • FontSize is float and fdl.Font is Font.

    If you need to get the font size selected, use fdl.Font.Size instead.

    • Marked as answer by tuan1296 Monday, September 17, 2018 4:38 AM
    Monday, September 17, 2018 4:32 AM
    Answerer

All replies