Home » FAQ » WinForms » Fonts » When I try to set a particular font style, say italics, I get an error message ‘Property cannot be assigned to — it is read only’. How can I set this read only property
Code such as
tabControl1.Font.Italic = true;
will not work. Instead, you have to create a new Font object, and set the property during its creation. This code will work.
tabControl1.Font = new Font(tabControl1.Font, FontStyle.Italic);
Platform BlazorASP.NETWinFormsWPF.NET MAUI
Question *
Answer (Optional)
Email (Optional)
Email address is only for further clarification on your FAQ request. It will not be used for any other purpose.
Please leave this field empty.
Share with