2

我正在以这种方式使用 [Style] 类:

public class ServerControl1 : System.Web.UI.Control
{
    ....

    protected override void OnPreRender(EventArgs e)
    {
      Style wrapperStyle = new Style();

      wrapperStyle.BorderColor = BorderColor;
      ....
      ....

      this.Page.Header.StyleSheet.CreateStyleRule(wrapperStyle, null, key);

      .....
     }
}

如何添加 [line-height] 或其他内容?

4

1 回答 1

2
wrapperStyle.Attributes.Add("class","wrapper_class");

在你的 CSS 文件中

.wrapper_class {
    line-height:24px;
}

编辑:

wrapperStyle.Style.Add("line-height","24px");
于 2012-11-05T12:32:57.850 回答