Font Properties and how to use them

P

Pete Ehli

Hello List,
I have a custom web control that during the render phase of the controls
life cycle I am rendering a table with one row and two columns. I have text
inside a column of this table and I want a user of my control to be able to
change the Font properties of this text. Below is the code I'm using to
change the FontInfo subproperties.

System.Web.UI.WebControls.Style st = new Style();

[DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
NotifyParentProperty(true)]
//,PersistenceMode(PersistenceMode.InnerProperty)]
public FontInfo Font
{
get
{
return this.st.Font;
}
}

My control inherits from Control since it doesn't render any HTML (but a lot
of DHTML) except this simple table. I'm using the HtmlTextWriter's
writer.writeline method to render the table but how can I use my Font
subproperties to change my table text. The font properties are rendered via
the aspx page that contains my control as hyphen delimited Font-Names="Arial
Black" Font-Size="Medium" etc Is there an easy way to add these properties
to my table text in stead of having to write them like so...
"<Font Face=" + "'" + Font.Name + "'" + ">" + My Table Text + "</Font>"

Thanks in advance
 
P

Peter Ehli

I'm not following what this has to do with a Web Control Library. As a
control author I want to make it as easy as possible for a developer to add
my control to the (toolbox i..e dll) drag and drop it onto a form and then
change some properties and run the page that contains the control. To change
the Font Face and Size of an ASP.NET command button you don't need a style
sheet. Sure you can use a CSS if you have multiple command buttons which is
a practice I'm familiar with. I want my control to act like a command button
for instance when a user of my control changes the font properties. Thanks.



Vidar Petursson said:
Hi

Why not css

<table style="font-family:arial,verdana,font-size:" + daSize.....

More info
http://msdn.microsoft.com/library/d...hor/dhtml/reference/dhtml_reference_entry.asp

--
Best Regards
Vidar Petursson
==============================
Microsoft Scripting MVP
http://www.microsoft.com/technet/scriptcenter
==============================
Pete Ehli said:
Hello List,
I have a custom web control that during the render phase of the controls
life cycle I am rendering a table with one row and two columns. I have
text
inside a column of this table and I want a user of my control to be able
to
change the Font properties of this text. Below is the code I'm using to
change the FontInfo subproperties.

System.Web.UI.WebControls.Style st = new Style();

[DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
NotifyParentProperty(true)]
//,PersistenceMode(PersistenceMode.InnerProperty)]
public FontInfo Font
{
get
{
return this.st.Font;
}
}

My control inherits from Control since it doesn't render any HTML (but a
lot
of DHTML) except this simple table. I'm using the HtmlTextWriter's
writer.writeline method to render the table but how can I use my Font
subproperties to change my table text. The font properties are rendered
via
the aspx page that contains my control as hyphen delimited
Font-Names="Arial
Black" Font-Size="Medium" etc Is there an easy way to add these properties
to my table text in stead of having to write them like so...
"<Font Face=" + "'" + Font.Name + "'" + ">" + My Table Text + "</Font>"

Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top