|
|
|
date: Sun, 20 Jul 2008 19:19:23 -0600,
group: microsoft.public.dotnet.framework.windowsforms.controls
back
Re: LinkLabel - how long is the displayed text?
Hi;
LinkLabel.Size seems to only grow, never shrink. Is there a way to get
it to reduce size when I give it new text and the new text is shorter?
thanks - dave
On Mon, 21 Jul 2008 06:18:22 GMT, jialge@online.microsoft.com
("Jialiang Ge [MSFT]") wrote:
>Hello Dave,
>
>I suddenly realize that you meant the length of the entire displayed text
>instead of its font size. If the 'AutoSize' property is true, we can
>retrieve the text length with the LinkLabel.Size.Width property; otherwise,
>we may need to call MeasureString to get the length of the text based on
>its font (LinkLabel.Font)
>http://msdn.microsoft.com/en-us/library/system.drawing.graphics.measurestrin
>g.aspx
>
>Regards,
>Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
>Microsoft Online Community Support
>
>=================================================
>Delighting our customers is our #1 priority. We welcome your comments and
>suggestions about how we can improve the support we provide to you. Please
>feel free to let my manager know what you think of the level of service
>provided. You can send feedback directly to my manager at:
>msdnmg@microsoft.com.
>
>This posting is provided "AS IS" with no warranties, and confers no rights.
>=================================================
david@at-at-at@windward.dot.dot.net
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com
Cubicle Wars - http://www.windwardreports.com/film.htm
date: Mon, 21 Jul 2008 14:43:26 -0600
author: David Thielen am
Re: LinkLabel - how long is the displayed text?
Hi;
Thank you - got it working. I think it requires some messages to fire
to happen (MessageBox causes everything to fire). I moved where I get
it and it works fine now.
thanks - dave
On Tue, 22 Jul 2008 07:25:32 GMT, jialge@online.microsoft.com
("Jialiang Ge [MSFT]") wrote:
>Hello Dave,
>
>Please make sure that LinkLabel.AutoSize is set to true beforehand. It
>grows and never shrink when AutoSize is false. Here is an example:
>
>this.linkLabel1.AutoSize = true;
>
>this.linkLabel1.Text = "1";
>MessageBox.Show(this.linkLabel1.Size.Width.ToString());
>this.linkLabel1.Text = "12";
>MessageBox.Show(this.linkLabel1.Size.Width.ToString());
>this.linkLabel1.Text = "1";
>MessageBox.Show(this.linkLabel1.Size.Width.ToString());
>
>The code outputs "98", "151", "98" on my side.
>
>If this suggestion does not work for you, please you please give some code
>snippets that I can reproduce the problem?
>
>Regards,
>Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
>Microsoft Online Community Support
>
>=================================================
>Delighting our customers is our #1 priority. We welcome your comments and
>suggestions about how we can improve the support we provide to you. Please
>feel free to let my manager know what you think of the level of service
>provided. You can send feedback directly to my manager at:
>msdnmg@microsoft.com.
>
>This posting is provided "AS IS" with no warranties, and confers no rights.
>=================================================
david@at-at-at@windward.dot.dot.net
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com
Cubicle Wars - http://www.windwardreports.com/film.htm
date: Wed, 23 Jul 2008 13:36:11 -0600
author: David Thielen am
|
|