日期:2014-05-17 浏览次数:20754 次
1、定义两个,公共属性。 public string lblText{get;this.lable.text = value}; public string lblText2{get;this.lable2.text = value}; 然后 this.textbox.text = lblText;
------解决方案--------------------
控件1:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsControlLibrary1 { public partial class UserControl1: UserControl { public UserControl1() { InitializeComponent(); } private string text1; public string Text1 { get { return text1; } set { text1 = value; this.label1.Text = text1; } } public delegate void myDelegate(eventData e); public event myDelegate btClick; private void button1_Click(object sender, EventArgs e) { this.text1 = this.textBox1.Text;//单点击按钮时 eventData _eventdata=new eventData(); _eventdata.tempData=this.Text1; if (btClick!=null) { btClick(_eventdata); } } } public class eventData : EventArgs { public string tempData; } }