Table的RenderControl方法呈现 到输出流中,比如Label控件或只是从服务端单向显示的信息的控件。笔者做过的一个WebChart 控 件示例,就是通过Table来呈现Chart图表的,详情请访问以下网站:
http://blog.csdn.net/ChengKing/archive/2007/09/15/1786409.aspx
针对控件的每个功能点都已经讲解完毕。最后,控件的完整源代码如下:
/// <summary>
/// 获得本书更多内容,请看:
/// http://blog.csdn.net/ChengKing/archive/2008/08/18/2792440.aspx
/// </summary>
[DefaultProperty("TextBoxValue")]
[ToolboxData("<{0}:Field runat=server></{0}:Field>")]
public class Field : CompositeControl
{
private Label lb;
private TextBox tb;
private RegularExpressionValidator rev;
[Category("LabelTextBox")]
[Description("标签显示信息")]
public string LabelTitle
{
get
{
this.EnsureChildControls();
return this.lb.Text;
}
set
{
this.EnsureChildControls();
this.lb.Text = value;
}
}
[Category("LabelTextBox")]
[Description("文本框显示文本")]
public string TextBoxValue
{
get
{
this.EnsureChildControls();
return tb.Text;
}
set
{
this.EnsureChildControls();
tb.Text = value;
}
}
[Category("LabelTextBox")]
[Description("标签宽度")]
public Unit LabelWidth
{
get
{
this.EnsureChildControls();
return this.lb.Width;
}
set
{
this.EnsureChildControls();
this.lb.Width = value;
}
}
[Category("LabelTextBox")]
[Description("标签高度")]
public Unit LabelHeight
{
get
{
this.EnsureChildControls();
return this.lb.Height;
}
set
{
this.EnsureChildControls();
this.lb.Height = value;
}
}
private Unit unitTextBoxWidth = Unit.Empty;
[Category("LabelTextBox")]
[Description("文本框宽度")]
public Unit TextBoxWidth
{
get
{
this.EnsureChildControls();
return this.tb.Width;
}
set
{
this.EnsureChildControls();
this.tb.Width = value;
}
}
private Unit unitTextBoxHeight = Unit.Empty;
[Category("LabelTextBox")]
[Description("文本框宽度")]
public Unit TextBoxHeight
{
get
{
this.EnsureChildControls();
return this.tb.Height;
}
set
{
this.EnsureChildControls();
this.tb.Height = value;
}
}
[Category("LabelTextBox")
|