本文整理匯總了C#中System.Web.UI.IStyleSheet接口的典型用法代碼示例。如果您正苦於以下問題:C# IStyleSheet接口的具體用法?C# IStyleSheet怎麽用?C# IStyleSheet使用的例子?那麽, 這裏精選的接口代碼示例或許可以為您提供幫助。
IStyleSheet接口屬於System.Web.UI命名空間,在下文中一共展示了IStyleSheet接口的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Page_Load
public partial class istylesheetcs : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Create a Style object to hold style rules to apply to a Label control.
Style labelStyle = new Style();
labelStyle.ForeColor = System.Drawing.Color.DarkRed;
labelStyle.BorderColor = System.Drawing.Color.DarkBlue;
labelStyle.BorderWidth = 2;
// Register the Style object so that it can be merged with
// the Style object of the controls that use it.
Page.Header.StyleSheet.RegisterStyle(labelStyle, null);
// Merge the labelCssStyle style with the label1 control's
// style settings.
label1.MergeStyle(labelStyle);
label1.Text = "This is what the labelCssStyle looks like.";
// Create a Style object for the <BODY> section of the Web page.
Style bodyStyle = new Style();
bodyStyle.ForeColor = System.Drawing.Color.Blue;
bodyStyle.BackColor = System.Drawing.Color.LightGray;
// Add the style to the header of the current page.
Page.Header.StyleSheet.CreateStyleRule(bodyStyle, null, "BODY");
// Add text to the label2 control to see the label without
// the labelStyle applied to it.
label2.Text = "This is what the bodyStyle looks like.";
}
}