上記の例のプロパティのように、説明付きのカスタムコントロールにプロパティを追加したいと思います。上記のようなGUIでそれを表示するのが辛いのかわかりません。使用する属性を知りたい。
private bool IsNum = true;
[PropertyTab("IsNumaric")]
[Browsable(true)]
[Description("TextBox only valid for numbers only"), Category("EmSoft")]
public bool IsNumaricTextBox
{
set
{
IsNum = value;
}
}
protected override void OnKeyPress(KeyPressEventArgs e)
{
base.OnKeyPress(e);
if (IsNum)
{
doStruf(e);
}
}
private void doStruf(KeyPressEventArgs e)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "\\d+") && !char.IsControl(e.KeyChar))
e.Handled = true;
}
これを説明付きのプロパティツールボックスとして表示したい
プロパティボックスでこのように
IsNumaric True