I have a form consisting of a button bar (currently bottom aligned) and a THTMLabel (currently Top aligned).
I'm trying to fill the HTMLLabel with content, then Autosize it - then adjust the height of the form to match the content.
My current code is:
procedure TForm1.OKButtonClick(Sender: TObject);
const
Base='Charge $9.00 to\[Welcome Drink - HKI''s] Account?';
var
I:integer;
M:string;
begin
Height:=450;
M:='';
for I := 1 to string(LinesCOunt.Text).ToInteger do
M:=M+Base+'\';
MessageLabel.HTMLText.Text:=M.Replace('\','
');
MessageLabel.Doit;
ClientHeight:=Self.MessageLabel.ClientHeight+Self.ButtonPanel.Height+10;
end;
However I just can't get this to work reliably.
What is the correct approach ?