📄 style.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace NetFocus.Web.Applications.Forum
{
public class Style : LiteralControl
{
private const string linkFormat = "<link rel=\"stylesheet\" href=\"{0}\" type=\"text/css\" media=\"{1}\" />";
[DefaultValue( "screen" ),]
public virtual String Media {
get {
Object state = ViewState["Media"];
if ( state != null ) {
return (String)state;
}
return "screen";
}
set {
ViewState["Media"] = value;
}
}
public virtual String Href {
get
{
string state = (string) ViewState["Href"];
if ( state != null )
{
if (state.StartsWith("/") || state.StartsWith(".") || state.StartsWith("~") || state.StartsWith("http://"))
return ResolveUrl(state) + "?tag=" + Guid.NewGuid().ToString();
else
return ResolveUrl("~/Themes/Default/Styles/" + state) + "?tag=" + Guid.NewGuid().ToString();
}
else
return "";
}
set
{
ViewState["Href"] = value;
}
}
protected override void Render(HtmlTextWriter writer)
{
if (!string.IsNullOrEmpty(Href))
{
writer.Write(linkFormat, Href, Media);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -