Custom Control Font Property

R

Remy Samulski

Dear readers,

Have a web custom control going but can't seem to manage this easy
thing.

The custom control inherits from System.Web.UI.WebControls.WebControl.
The custom control consists of 2 images and a label. The Custom
Control has from default a Font property. How can I use the default
Font Property to set the Label Font property?

Many thanks,
Rémy
 
N

Nenad Prekupec

in place where you want to use default font property like
Me.Font.Bold for example in Render method:

if (Me.Font.Bold) then
output.write("<bold>")
end if
output.write (me.Text)
.....
if (Me.Font.Bold) then
output.write("</bold>")
end if
 
R

Remy Samulski

Nenad Prekupec said:
in place where you want to use default font property like
Me.Font.Bold for example in Render method:

if (Me.Font.Bold) then
output.write("<bold>")
end if
output.write (me.Text)
.....
if (Me.Font.Bold) then
output.write("</bold>")
end if

Thanks for your reply!

I prefer .NET Framework to do the HTML makeup. When I set the standard
Font property of my custom control (prcDecisionPossibleUserSet) I get
the following HTML result:

<span id="prcDecisionPossibleUserSet" LaatZien="True"
style="font-family:Arial;font-size:Smaller;Z-INDEX: 102; LEFT: 976px;
POSITION: absolute; TOP: 56px">
<table bordercolor="Green" border="0"
style="border-color:Green;border-width:2px;border-style:solid;height:32px;width:200px;">
<tr>
<td><img src="Images/Decision.gif" border="0"
style="height:32px;width:15px;" /></td>
<td align="Center" valign="Middle"><span>LABEL _lblText</span></td>
<td><img src="Images/Decision_right.gif" border="0"
style="height:32px;width:15px;" /></td>
</tr>
</table>
</span>

As you can see the standard font property of my custom control is
implemented in the first SPAN tag. But the SPAN surrounding the LABEL
has no font definition. I have tried:
Me._lblText.Font.CopyFrom(Me.Font) but the SPAN tag stays empty.
Anyone a suggestion?


Many thanks
 
N

Nenad Prekupec

according to the source html code you have posted I presume that you need a
bit customizing either Render or RenderChildren method.
As I can see you are doing that already but important question is how?!
at the point where you are rendering that span where you want your font to
be applied you should use Font properties of your custom control...
have you tried
_lblText.Font = Me.Font?
if this doesn'e work try applying Font on that span?
 

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

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top