Introduction
During the development of some ASP.NET components, I experienced a bit of a trouble implementing the FontInfo
property for ASP.NET components. First of all, I didn't find a public
constructor for the FontInfo
class. But there is a Style class which could be used to create a FontInfo
instance.
FontInfo _myFont;
Style _style;
_style=new System.Web.UI.WebControls.Style();
_myFont =style.Font;
Another thing I've found is that the newly created FontInfo
property is not serialized in the ASPX form like other properties. And every time I reopen the web form, at design time, the FontInfo
property gets its default value = "". This problem was solved by adding the DesignerSerializationVisibility
attribute:
<Bindable(true),DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
Category("Appearance"),
Description ("My font property.")>
public FontInfo MyFont
{...}
Now the control on the web form serializes the information about the FontInfo
property:
<cc1:mywebcontrol id="MyWebControl1" runat="server"
Height="50px" Width="450px"
MyFont-Names="Century Gothic" MyFont-Italic="True" >
</cc1:mywebcontrol>
Hope that helps!
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.