با این، UserControl شما یک رویداد به اسم ButtonClick پیدا میکنه و دو Property جدید.
public partial class UserControl1 : UserControl
{
public event EventHandler ButtonClick;
public UserControl1()
{
InitializeComponent();
}
public ComoboBox.ObjectCollection Items
{
get { return comboBox1.Items; }
}
[DefaultValue("")]
public string ButtonText
{
get { return button1.Text; }
set { button1.Text = value; }
}
private void button1_Click(object sender, EventArgs e)
{
if (ButtonClick != null)
{
ButtonClick(this, e);
}
}
}