namespace Wnd { public partial class ButtonTextBox : UserControl { [Browsable(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public event EventHandler ButtonClick; [DefaultValue(false)] public bool ReadOnly { get { return _ReadOnly; } set { _ReadOnly = value; OnReadOnlyChanged(); } } private bool _ReadOnly; public ButtonTextBox() { InitializeComponent(); } private void btnButton_Click(object sender, EventArgs e) { ButtonClick(sender, e); } protected virtual void OnReadOnlyChanged() { if (this.ReadOnly) { this.txtText.BackColor = Color.FromKnownColor(KnownColor.Info); } } } }