自定义控件

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; }
       }


    }
}

 

posted @ 2017-05-18 17:46  捡贝壳的孩子  阅读(120)  评论(0编辑  收藏  举报