Number Characters to fit in control

Number Characters to fit in control

Post by Domini » Sat, 07 Oct 2000 04:00:00



Given the font, font size, and control type and width, is is possible to
calculate how many characters will fit into the visiblearea of an edit
control?
For example I want to create a function called FitStringtoControl, which
passed a edit control, and single character, will pad out the returned
string until it exactly fits the width of the control.
Thanks
Dom
 
 
 

Number Characters to fit in control

Post by David Marcu » Tue, 10 Oct 2000 04:00:00



> Given the font, font size, and control type and width, is is possible to
> calculate how many characters will fit into the visiblearea of an edit
> control?
> For example I want to create a function called FitStringtoControl, which
> passed a edit control, and single character, will pad out the returned
> string until it exactly fits the width of the control.

Canvas.TextWidth will tell you the width of a string in pixels.

--
David Marcus