Hi Mix from Latvia,
I have tested your code, and it worked well on my machine. As you have generated code for the TextEnding property, the TextEnding will be added to the Text property twice, one by designer and the other by the code. So I suggest you use the DesignerSerializationVisibility.Hidden to not produce code for the TextEnding property. Try something like the following:
Code Block
class ExLabel :Label
{
private string textEnding;
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Bindable(false)]
[DefaultValue("")]
[Category("Appearance")]
public string TextEnding
{
get
{
return textEnding;
}
set
{
textEnding = value;
Text = Text + value;
}
}
}
If this does not help, you can try to call the Control.Invalidate method in the set accessor.
Code Block
set
{
textEnding = value;
Text = Text + value;
this.Invalidate();
}
Hope this helps.
Best regards.
Rong-Chun Zhang