Calculating Needing Padding for Label Control

  • Thread starter Thread starter John Bowman
  • Start date Start date
J

John Bowman

Hello,

I need to concatonate 2 strings and insert padding spaces in between them.
The number of padding spaces needs to be calculated such that I can place
the entire resultant string into a label control and have it appear as if
the 1st string is left justified & the 2nd string is right justified. How
can I properly calculate the number of needed spaces when I'm using the
label control's default MS Sans Serif font? OR does anyone have a better
mechanism for accomplishing this sort of feat visually.

TIA,
 
John,

Why not create a control which has two labels on it. One label is
anchored to the left, the other is anchored to the right. Also, the label
on the left is aligned to the left of the label, and the label on the right
is aligned to the right of the label.

Hope this helps.
 
Nicholas,

Thanks for the tip. I'll look into it.

John

Nicholas Paldino said:
John,

Why not create a control which has two labels on it. One label is
anchored to the left, the other is anchored to the right. Also, the label
on the left is aligned to the left of the label, and the label on the right
is aligned to the right of the label.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

John Bowman [email protected]> said:
Hello,

I need to concatonate 2 strings and insert padding spaces in between them.
The number of padding spaces needs to be calculated such that I can place
the entire resultant string into a label control and have it appear as if
the 1st string is left justified & the 2nd string is right justified. How
can I properly calculate the number of needed spaces when I'm using the
label control's default MS Sans Serif font? OR does anyone have a better
mechanism for accomplishing this sort of feat visually.

TIA,

--
John C. Bowman
Software Engineer
Thermo Electron Scientific Instruments Div.
<Remove this before reply> (e-mail address removed)
 
Back
Top