自定义控件(1)HelloWorld

来源:互联网 发布:湖北省软件协会 编辑:程序博客网 时间:2024/06/06 00:07

下面定义一个最基础的控件HelloWorld

cs代码

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Web.UI;namespace kjlx.BLL.HelloWorld{    //继承自Control    public class HelloWorld : Control    {        //Render,呈现,Control就是通过这一方法来输出内容的.        protected override void Render(HtmlTextWriter writer)        {            writer.WriteLine("Hello World!");        }    }}

重新生成解决方案,控件自动添加到选项卡


拖动到页面运行



原创粉丝点击