public class MyOwntextbox : TextBox { [Bindable(false)] [Category("Properties")] [DefaultValue("")] [Localizable(true)] public string MyTipPreText {// This property will be available in Properties window - design mode get { return tipPreText; }
set { tipPreText = value; } }
public string tipPreText;
protected override void OnMouseHover(EventArgs e) { System.Windows.Forms.ToolTip t = new ToolTip(); t.SetToolTip(this, tipPreText + " is my Tipss"); } }
2012-08-16 00:13
Extender classes as above allow you to extend the functionality of a .NET control
class.
2012-08-16 00:16
This blog is frozen. No new comments or edits allowed.
Here we extend a textBox with new property
public class MyOwntextbox : TextBox
{
[Bindable(false)]
[Category("Properties")]
[DefaultValue("")]
[Localizable(true)]
public string MyTipPreText
{// This property will be available in Properties window - design mode
get
{
return tipPreText;
}
set
{
tipPreText = value;
}
}
public string tipPreText;
protected override void OnMouseHover(EventArgs e)
{
System.Windows.Forms.ToolTip t = new ToolTip();
t.SetToolTip(this, tipPreText + " is my Tipss");
}
}