Ask a Question related to ASP.NET Building Controls, Design and Development.
-
sadhu #1
Problem w Font property in Custom Control
Hi,
I'm developing a simple composite control with 2 child controls, a
Label and a TextBox. I expose easily many properties of the inner
controls, in the form i.e.:
BoxToolTip & LabelToolTip,
BoxForeColor & LabelForeColor,
BoxCssClass & labelCssClass...
but when I try to insert the BoxFont & LabelFont properties,
they correctly appears in the designer and it's apparently possible to
set them but no attribute like font-size="..." or font-family="..." is
wrote on the aspx page that holds the control. I can't set directly the
Font property of the child control, because it's readonly.
Here's the code:
[Browsable(true), Category("Appearance"), DefaultValue("")]
public FontInfo BoxFont
{
get
{
return box.Font;
}
set
{
FontInfo f = (FontInfo) value;
box.Font.Bold = f.Bold;
box.Font.Italic = f.Italic;
box.Font.Name = f.Name;
box.Font.Names = f.Names;
box.Font.Overline = f.Overline;
box.Font.Size = f.Size;
box.Font.Strikeout = f.Strikeout;
box.Font.Underline = f.Underline;
}
}
Thanx for yr kind answer
Silvano
sadhu Guest
-
Custom control with complex property type (System.Web.UI.Control[])
I've built a control with a property of type System.Web.UI.Control. I have a custom editor which allows me to add items to this collection at... -
Problem with Custom Web Control Property
Hello all, I'm developing a custom web control that mount a webpage, but now i don't can to modify the properties of my custom web control. by... -
Keep custom property-value in custom rendered control
Hi there, here's the thing I have a custom control (rendered) with a label, textbox and some validators. I use that for entering a birthdate, to... -
Custom Control Font Property
Dear readers, Have a web custom control going but can't seem to manage this easy thing. The custom control inherits from... -
Exposing Font Name Property for Custom Control
Hi, I've created a custom web control for using in my web application. I want to expose some Font-Name Properties of the control like i did for... -
lisa@starways.net #2
Re: Problem w Font property in Custom Control
You want to use the CopyFrom method for this. In your set, do like
this:
box.Font.CopyFrom(Value);
HTH,
Lisa
sadhu wrote:to> Hi,
> I'm developing a simple composite control with 2 child controls, a
> Label and a TextBox. I expose easily many properties of the inner
> controls, in the form i.e.:
>
> BoxToolTip & LabelToolTip,
> BoxForeColor & LabelForeColor,
> BoxCssClass & labelCssClass...
>
> but when I try to insert the BoxFont & LabelFont properties,
> they correctly appears in the designer and it's apparently possibleis> set them but no attribute like font-size="..." or font-family="..."the> wrote on the aspx page that holds the control. I can't set directly> Font property of the child control, because it's readonly.
>
> Here's the code:
>
> [Browsable(true), Category("Appearance"), DefaultValue("")]
> public FontInfo BoxFont
> {
> get
> {
> return box.Font;
> }
> set
> {
> FontInfo f = (FontInfo) value;
> box.Font.Bold = f.Bold;
> box.Font.Italic = f.Italic;
> box.Font.Name = f.Name;
> box.Font.Names = f.Names;
> box.Font.Overline = f.Overline;
> box.Font.Size = f.Size;
> box.Font.Strikeout = f.Strikeout;
> box.Font.Underline = f.Underline;
> }
> }
>
> Thanx for yr kind answer
>
> Silvanolisa@starways.net Guest



Reply With Quote

