using System;
using System.Windows.Forms;
using System.Drawing;
namespace WindowsFormsApplication1
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
this.Controls.Add(new ExTextBox());
}
public class ExTextBox : TextBox
{
public ExTextBox()
{
this.Text = "わお";
}
/// <summary>
/// プロパティの非表示
/// </summary>
public new Boolean ReadOnly
{
get
{
return base.ReadOnly;
}
set
{
base.ReadOnly = value;
if (value)
{
this.BackColor = Color.FromArgb(255, 255, 200);
}
else
{
this.BackColor = Color.FromArgb(255, 255, 255);
}
}
}
/// <summary>
/// メソッドのオーバーライド
/// </summary>
/// <param name="e"></param>
protected override void OnClick(EventArgs e)
{
MessageBox.Show("WOW");
base.OnClick(e);
}
}
}
}
最終更新:2011年06月22日 19:41