D
David Sworder
Hi,
A Windows form that I'm developing will have two controls: Label1 and
Label2. Both controls are of type Label (go figure). The text of Label1 will
not be known until runtime and may change at times. When the MyText property
of the containing form is set, I want to:
a) Set the Label1.Text property appropriately.
b) Change the width of Label1 so that it is exactly wide enough to show
the text.
c) Move Label2 so that its left edge is equal to Label1's right edge +
1.
Steps (a) and (c) are easy, but I'm not sure how to approach step (b).
Given a string, how do I set the width of Label1 to a value that is exactly
large enough to show the string?
David
A Windows form that I'm developing will have two controls: Label1 and
Label2. Both controls are of type Label (go figure). The text of Label1 will
not be known until runtime and may change at times. When the MyText property
of the containing form is set, I want to:
a) Set the Label1.Text property appropriately.
b) Change the width of Label1 so that it is exactly wide enough to show
the text.
c) Move Label2 so that its left edge is equal to Label1's right edge +
1.
Steps (a) and (c) are easy, but I'm not sure how to approach step (b).
Given a string, how do I set the width of Label1 to a value that is exactly
large enough to show the string?
David