📄 tablestyle.cs
字号:
using System;
using System.Globalization;
namespace System.Web.UI.WebControls
{
/// <summary>
/// Summary description for TableStyle.
/// </summary>
public class TableStyle : Style
{
private const int PROP_BACKIMAGEURL = 65536;
private const int PROP_CELLPADDING = 131072;
private const int PROP_CELLSPACING = 262144;
private const int PROP_GRIDLINES = 524288;
private const int PROP_HORZALIGN = 1048576;
public TableStyle() : base()
{
}
public TableStyle(StateBag bag) : base(bag)
{
}
public virtual void AddAttributesToRender(HtmlTextWriter writer, WebControl owner)
{
string local0;
int local1;
HorizontalAlign local2;
GridLines local3;
string local4;
GridLines local5;
this.AddAttributesToRender(writer, owner);
local0 = this.BackImageUrl;
if (local0.Length != 0)
{
// if (owner != null)
// local0 = owner.ResolveUrl(local0);
// writer.AddStyleAttribute(HtmlTextWriterAttribute.Align, "url(" + local0 + ")");
}
local1 = this.CellSpacing;
if (local1 >= 0)
{
writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, local1.ToString(NumberFormatInfo.InvariantInfo));
// if (local1 == 0)
// writer.AddStyleAttribute(HtmlTextWriterAttribute.Alt, "collapse");
}
local1 = this.CellPadding;
if (local1 >= 0)
writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, local1.ToString(NumberFormatInfo.InvariantInfo));
local2 = this.HorizontalAlign;
if (local2 != 0)
writer.AddAttribute(HtmlTextWriterAttribute.Align, System.Enum.Format(typeof(HorizontalAlign), local2, "G"));
local3 = this.GridLines;
if (local3 != 0)
{
local4 = System.String.Empty;
local5 = this.GridLines;
switch (local5 - 1)
{
case (GridLines)2:
local4 = "all";
break;
break;
case (GridLines)0:
local4 = "rows";
break;
break;
case (GridLines)1:
local4 = "cols";
break;
}
writer.AddAttribute(HtmlTextWriterAttribute.Rules, local4);
}
}
public virtual void CopyFrom(Style s)
{
TableStyle local0;
if (s != null && !(s.IsEmpty))
{
this.CopyFrom(s);
if (s as TableStyle != null)
{
local0 = (TableStyle) s;
if (local0.IsSet(65536))
this.BackImageUrl = local0.BackImageUrl;
if (local0.IsSet(131072))
this.CellPadding = local0.CellPadding;
if (local0.IsSet(262144))
this.CellSpacing = local0.CellSpacing;
if (local0.IsSet(524288))
this.GridLines = local0.GridLines;
if (local0.IsSet(1048576))
this.HorizontalAlign = local0.HorizontalAlign;
}
}
}
public virtual void MergeWith(Style s)
{
TableStyle local0;
if (s != null && !(s.IsEmpty))
{
if (this.IsEmpty)
{
this.CopyFrom(s);
return;
}
this.MergeWith(s);
if (s as TableStyle != null)
{
local0 = (TableStyle) s;
if (local0.IsSet(65536) && !(this.IsSet(65536)))
this.BackImageUrl = local0.BackImageUrl;
if (local0.IsSet(131072) && !(this.IsSet(131072)))
this.CellPadding = local0.CellPadding;
if (local0.IsSet(262144) && !(this.IsSet(262144)))
this.CellSpacing = local0.CellSpacing;
if (local0.IsSet(524288) && !(this.IsSet(524288)))
this.GridLines = local0.GridLines;
if (local0.IsSet(1048576) && !(this.IsSet(1048576)))
this.HorizontalAlign = local0.HorizontalAlign;
}
}
}
public virtual void Reset()
{
if (this.IsSet(65536))
this.ViewState.Remove("BackImageUrl");
if (this.IsSet(131072))
this.ViewState.Remove("CellPadding");
if (this.IsSet(262144))
this.ViewState.Remove("CellSpacing");
if (this.IsSet(524288))
this.ViewState.Remove("GridLines");
if (this.IsSet(1048576))
this.ViewState.Remove("HorizontalAlign");
this.Reset();
}
public virtual string BackImageUrl
{
get
{
if (this.IsSet(65536))
return (String) this.ViewState["BackImageUrl"];
return System.String.Empty;
}
set
{
if (value == null)
throw new ArgumentNullException("value");
this.ViewState["BackImageUrl"]= value;
this.SetBit(65536);
}
}
public virtual int CellPadding
{
get
{
if (this.IsSet(131072))
return (Int32) this.ViewState["CellPadding"];
return -1;
}
set
{
if (value < -1)
throw new ArgumentOutOfRangeException("value");
this.ViewState["CellPadding"]= value;
this.SetBit(131072);
}
}
public virtual int CellSpacing
{
get
{
if (this.IsSet(262144))
return (Int32) this.ViewState["CellSpacing"];
return -1;
}
set
{
if (value < -1)
throw new ArgumentOutOfRangeException("value");
this.ViewState["CellSpacing"]= value;
this.SetBit(262144);
}
}
public virtual GridLines GridLines
{
get
{
if (this.IsSet(524288))
return (GridLines) this.ViewState["GridLines"];
return (GridLines)0;
}
set
{
if (value < (GridLines)0 || value > (GridLines)3)
throw new ArgumentOutOfRangeException("value");
this.ViewState["GridLines"]= value;
this.SetBit(524288);
}
}
public virtual HorizontalAlign HorizontalAlign
{
get
{
if (this.IsSet(1048576))
return (HorizontalAlign) this.ViewState["HorizontalAlign"];
return (HorizontalAlign)0;
}
set
{
if (value < (HorizontalAlign)0 || value > (HorizontalAlign)4)
throw new ArgumentOutOfRangeException("value");
this.ViewState["HorizontalAlign"]= value;
this.SetBit(1048576);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -