using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
public void SetTextBox(string text)
{
this.textBox1.Text = text;
}
public string GetTextBox()
{
return textBox1.Text;
}
public void SetTextColor(Color color)
{
this.textBox1.BackColor = color;
}
public delegate void SetTextValue(string value);
public event SetTextValue OnBtnClick;
private void button1_Click(object sender, EventArgs e)
{
if (OnBtnClick != null)
{
OnBtnClick(this.textBox1.Text);//把TEXTBOX1的TEXT传递过去
}
}
}
}
FORM1的代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.Text.RegularExpressions;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}