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();

    public FontInfo 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. Advertisements

  2. Vidar Petursson, May 21, 2004
    1. Advertisements

  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.

    Peter Ehli, May 22, 2004
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.