Click here to Skip to main content
15,908,581 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello

I have a UserControl class for Vista Style Button on my C# Project. The properties for this button are:

BaseColor
BackImage
ButtonColor
ButtonStyle
CornerRadius
GlowColor
HighlightColor
Image
ImageAlign
ImageSize
ButtonText
TextAlign


Can someone help me create a property Behavior called AutoEllipsis

thanks in advance


lapeci
Posted

1 solution

If your controls inherits from button class, you can use the AutoEllipsis property of the button class itself.

Otherwise, you will have to do MeasureString on the text and compare the width it with the width of control. If the text width is more than controls, get a suitable substring of it and place "...". You should also implement a tooltip so that full text is shown with mouse hover happens.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900