using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;

namespace csMathControl
{
    
/// <summary>
    
/// Center 的摘要说明。
    
/// </summary>
    [DefaultProperty("Text"), 
        ToolboxData(
"<{0}:Center runat=server></{0}:Center>")]
    [ParseChildren(
false)]
    
public class Center : System.Web.UI.WebControls.WebControl,INamingContainer
    {
        
private string text;
    
        [Bindable(
true), 
            Category(
"Appearance"), 
            DefaultValue(
"")] 
        
public string Text 
        {
            
get
            {
                
return text;
            }

            
set
            {
                text 
= value;
            }
        }

        
/// <summary> 
        
/// 将此控件呈现给指定的输出参数。
        
/// </summary>
        
/// <param name="output"> 要写出到的 HTML 编写器 </param>
        protected override void Render(HtmlTextWriter output)
        {
            
//output.Write(Text);
            output.AddAttribute("align","center");
            output.AddStyleAttribute(
"BackGround-color","red");
            
//pannel开始
            output.RenderBeginTag("div");
            
foreach(Control ctrItem in Controls)
            {
                ctrItem.RenderControl(output);
            }
            output.RenderEndTag();
        }
        }
}
posted on 2006-03-23 17:27  kuning的程序博客  阅读(217)  评论(0)    收藏  举报