AdvSmoothPanel.Caption.HTMLText

Hi,


I am using the Caption.HTMLText proprety of the AdvSmoothPanel component. I'd like to implement some kind of Autosize property that would resize the height of the panel depending on the content of HTMLText. 

My question is simple : how can I calculate the height of a particular HTMLText string ?

Thanks!

Hi, 


You need to implement the GDIPHTMLEngine.pas file through an Include statement and use the following code:

implementation

uses
  CommCtrl, ShellApi;

{$I GDIPHTMLEngine.pas}



c := AdvSmoothPanel1.Caption;

  g := TGPGraphics.Create(Canvas.Handle);
  htmlr := Bounds(0, 0, 10000, 10000);
  HTMLDrawGDIP(g, c.HTMLFont, c.HTMLText, htmlr, nil, 0, 0, -1, -1, c.HTMLShadowOffset, False, True, False, False,
      False, False, True, 1.0, c.HTMLURLColor, clNone, clNone, c.HTMLShadowColor, a, s, k, XSize, YSize, l, m, hr, nil, nil, 2);
  g.free;

YSize will give you the height of the HTML Text.
Kind Regards, 
Scheldeman Pieter

Hi,


how can I do this in  C++ ?

Thanks

Sorry, there is no such easy way to do this in C++, as you can't include .PAS code in a CPP file.