首页 > 代码库 > 自定义控件

自定义控件

namespace WindowsFormsApplication5
{
    public partial class UserControl1 : UserControl
    {
        public UserControl1()
        {
            InitializeComponent();
        }
        public UserControl1(object oo)
        {
            MyUser myUser = new MyUser();
            myUser = (MyUser)oo;
            InitializeComponent();
            this.label1.Text = "标题" + myUser.Name;
            this.textBox1.Text = myUser.Content;
        }
    }
    public class MyUser
    { 
       private  string name;
       public string Name
       {
           set { name = value; }
           get { return name; }
       }
       private string content;
       public string Content
       {
           set { content = value;}
           get { return content; }
       }


    }
}

 

自定义控件