Font Properties and how to use them

Discussion in 'ASP .Net Building Controls' started by Pete Ehli, May 21, 2004.

  1. Pete Ehli

    Pete Ehli Guest

    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
    Pete Ehli, May 21, 2004
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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
    >
    >
    Vidar Petursson, May 21, 2004
    #2
    1. Advertising

  3. Pete Ehli

    Peter Ehli Guest

    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" <> wrote in
    message news:...
    > 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" <> wrote in message
    > news:...
    > > 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
    > >
    > >

    >
    >
    Peter Ehli, May 22, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nick Spinel
    Replies:
    0
    Views:
    932
    Nick Spinel
    Jul 25, 2003
  2. gino
    Replies:
    3
    Views:
    3,970
    Mike Smith
    Jul 11, 2004
  3. Anonieko

    HttpHandlers - Learn Them. Use Them.

    Anonieko, Jun 15, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    514
    tdavisjr
    Jun 16, 2006
  4. mttc
    Replies:
    2
    Views:
    2,383
    Roedy Green
    Jul 3, 2009
  5. why the lucky stiff
    Replies:
    5
    Views:
    140
    why the lucky stiff
    Sep 22, 2004
Loading...

Share This Page