📄 table.cs
字号:
using System;
using System.Collections;
using System.Drawing;
using System.Globalization;
namespace System.Web.UI.WebControls
{
/// <summary>
/// Summary description for Table.
/// </summary>
public class Table : System.Web.UI.WebControls.WebControl
{
private TableRowCollection rows;
protected class RowControlCollection : ControlCollection
{
internal RowControlCollection(Control owner) : base(owner)
{
}
public override void Add(Control child)
{
if (child as TableRow != null)
{
this.Add(child);
return;
}
throw new ArgumentException(System.Web.HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type", "Table", child.GetType().Name.ToString()));
}
public override void AddAt(int index, Control child)
{
if (child as TableRow != null)
{
this.AddAt(index, child);
return;
}
throw new ArgumentException(System.Web.HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type", "Table", child.GetType().Name.ToString()));
}
}
public Table() : base(HtmlTextWriterTag.Table)
{
}
protected virtual void AddAttributesToRender(HtmlTextWriter writer)
{
Color local0;
Unit local1;
GridLines local2;
int local3;
this.AddAttributesToRender(writer);
local0 = this.BorderColor;
if (!(local0.IsEmpty))
writer.AddAttribute(HtmlTextWriterAttribute.Bordercolor, System.Drawing.ColorTranslator.ToHtml(local0));
local1 = this.BorderWidth;
local2 = this.GridLines;
if (local2 == 0)
local1 = System.Web.UI.WebControls.Unit.Pixel(0);
else if (local1.IsEmpty || local1.Type != UnitType.Pixel)
local1 = System.Web.UI.WebControls.Unit.Pixel(1);
local3 = (int) local1.Value;
writer.AddAttribute(HtmlTextWriterAttribute.Border, local3.ToString(NumberFormatInfo.InvariantInfo));
}
protected virtual ControlCollection CreateControlCollection()
{
return new RowControlCollection(this);
}
protected virtual Style CreateControlStyle()
{
return new TableStyle(this.ViewState);
}
protected virtual void RenderContents(HtmlTextWriter writer)
{
IEnumerator local0;
TableRow local1;
local0 = this.Rows.GetEnumerator();
while (local0.MoveNext())
{
local1 = (TableRow) local0.Current;
local1.RenderControl(writer);
}
}
public virtual string BackImageUrl
{
get
{
if (!(this.ControlStyleCreated))
return System.String.Empty;
return ((TableStyle) this.ControlStyle).BackImageUrl;
}
set
{
((TableStyle) this.ControlStyle).BackImageUrl = value;
}
}
public virtual int CellPadding
{
get
{
if (!(this.ControlStyleCreated))
return -1;
return ((TableStyle) this.ControlStyle).CellPadding;
}
set
{
((TableStyle) this.ControlStyle).CellPadding = value;
}
}
public virtual int CellSpacing
{
get
{
if (!(this.ControlStyleCreated))
return -1;
return ((TableStyle) this.ControlStyle).CellSpacing;
}
set
{
((TableStyle) this.ControlStyle).CellSpacing = value;
}
}
public virtual GridLines GridLines
{
get
{
if (!(this.ControlStyleCreated))
return 0;
return ((TableStyle) this.ControlStyle).GridLines;
}
set
{
((TableStyle) this.ControlStyle).GridLines = value;
}
}
public virtual HorizontalAlign HorizontalAlign
{
get
{
if (!(this.ControlStyleCreated))
return 0;
return ((TableStyle) this.ControlStyle).HorizontalAlign;
}
set
{
((TableStyle) this.ControlStyle).HorizontalAlign = value;
}
}
public virtual TableRowCollection Rows
{
get
{
if (this.rows == null)
this.rows = new TableRowCollection(this);
return this.rows;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -