Tony 哥!好久不见...呵呵...

解决方案 »

  1.   

    private void button1_Click(object sender, EventArgs e)
            {
                UserControl1 uc = new UserControl1();//这里不对,自定义控件已经拖到窗体上,就不用再定义另一个了,这样定义的和你拖入窗体上的不是一个,你在界面设计里看看拖入的自定义控件的名称然后可以直接引用
                uc.Init(this.textBox1.Text);
            }
      

  2.   


    哎...郁闷!定义的控件 UserControl1 拖放入窗体后名称变为了 UserControl11 !
    呵呵...明白了,直接在 UserControl1 里面为控件创建属性,然后在主窗体中调用即可!呵呵...多谢提醒啦!
      

  3.   


    c#也很容易,但是写起来代码量实在太大了(我原来写pb的,后来写过几个月c#,后来又写过一段ASP,后来又写过一段extjs+spring+hibernate)
    现在又开始写C#,我就发觉c#写得代码最多
      

  4.   


    public override string Text
            {
                get
                {
                    return textBox1.Text;
                }
                set
                {
                    textBox1.Text = value;
                    textBox1.Invalidate();
                }
            }        public UserControl1()
            {
                InitializeComponent();
            }
      

  5.   


    public partial class UserControl1 : UserControl
        {
            public override string Text
            {
                get
                {
                    return textBox1.Text;
                }
                set
                {
                    textBox1.Text = value;
                    textBox1.Invalidate();
                }
            }        public UserControl1()
            {
                InitializeComponent();
            }
        }