kkding

无心无为 手机电脑一个都不能少。

 

昨天花了一天的时间做一个简单的simpleeditor,头晕

  1using System;
  2using System.ComponentModel;
  3using System.Collections;
  4using System.IO;
  5using System.Globalization;
  6using System.Resources;
  7using System.Web;
  8using System.Web.UI;
  9using System.Web.UI.WebControls;
 10using System.Reflection;
 11using System.Drawing;
 12namespace Kkding.Web.UI.WebControls
 13{
 14    /// <summary>
 15    /// SimpleEditor 的摘要说明。
 16    /// </summary>

 17    [
 18    DefaultProperty("Text"),
 19    Designer(typeof(SimpleEditorDesign)),
 20    ToolboxData("<{0}:SimpleEditor runat=\"server\"></{0}:SimpleEditor>"),
 21    ToolboxBitmap(typeof(Kkding.Web.UI.WebControls.SimpleEditor))
 22    ]
 23    public class SimpleEditor :WebControl
 24    {
 25        private TextBox _EditTextBox;
 26        public override Unit Width
 27        {
 28            get
 29            {
 30                return _EditTextBox.Width;
 31            }

 32            set
 33            {
 34                _EditTextBox.Width = value;
 35            }

 36        }

 37        public override Unit Height
 38        {
 39            get
 40            {
 41                return _EditTextBox.Height;
 42            }

 43            set
 44            {
 45                _EditTextBox.Height = value;
 46            }

 47        }

 48        public override string ID
 49        {
 50            get
 51            {
 52                return _EditTextBox.ID;
 53            }

 54            set
 55            {
 56                _EditTextBox.ID = value;
 57            }

 58        }

 59
 60
 61        [
 62        NotifyParentProperty(true),
 63        Bindable(true),
 64        Category("Behavior"),
 65        Description("文本")
 66        ]
 67        public string Text
 68        {
 69            get
 70            {
 71                return _EditTextBox.Text;
 72            }

 73            set
 74            {
 75                _EditTextBox.Text = value;
 76            }

 77        }

 78        public SimpleEditor():base(HtmlTextWriterTag.Unknown)
 79        {
 80            //
 81            // TODO: 在此处添加构造函数逻辑
 82            //
 83            _EditTextBox = new TextBox();
 84            _EditTextBox.TextMode = TextBoxMode.MultiLine;
 85        }

 86        protected override void OnInit(EventArgs e)
 87        {
 88            
 89            _EditTextBox.EnableViewState = true;
 90            Controls.Add(_EditTextBox);
 91            base.OnInit (e);
 92        }

 93        protected override void Render(HtmlTextWriter writer)
 94        {
 95            writer.WriteLine("<link rel='STYLESHEET' type='text/css' href='/aspnet_client/kkding/SimpleEditor.css'>");
 96            writer.AddStyleAttribute("display","none");
 97            writer.AddStyleAttribute("Behavior","url('/aspnet_client/kkding/SimpleEditor.htc')");
 98            _EditTextBox.RenderControl(writer);
 99        }

100
101    }

102}

103

1.GIF

posted on 2007-06-05 12:17  kkding  阅读(470)  评论(2编辑  收藏  举报

导航