Page 1 of 1

Set length of embedded components

Posted: Tue Aug 15, 2006 7:18 am
by Kern
Hi

What is the best place to set the correct width and hight of embedded components like TCheckBox and TGroupBox.
And how do i calculate the values? They have no Canvas to get it by Canvas.TextLengt(). The Canvas of the "container"-RichView has an undefined value in OnControlAction.

Thanks

Posted: Tue Aug 15, 2006 11:19 am
by Sergey Tkachenko
I guess you need to calculate it yourself.
You can use, for example, the form's canvas.
Assign the same font as the button caption, and call Canvas.TextWidth.
Add a reasonable amount for spacing and checkmark.