Jump to content
Edwin Yip

Text overlapped in Delphi Html Component Library

Recommended Posts

Hi,

 

I wonder if anyone, especially @Alexander Sviridenkov can give me any advise as to solving the following ThtPanel (a control from delphihtmlcomponents.com) rendering issue (text overlapped) under win 10/11 (ok under win 7).

- The screenshot of the issue is attached.

- I'm using HCL 3.7 (not the latest, I know, but I'm afraid I need to solve this issue with this version at the moment).

- The html code used:

Trial Period's Expiring in 21 Day(s)<br />When in trial mode only <strong>20</strong> blabla.<br /><br /><a href="#buy">Buy MyProduct here</a><br /><br /><a href="#activate">Activate MyProduct</a> if you already have a license key

- The `ThtPanel` object:

var
  pnlMsg := THtPanel.Create(Self);
  pnlMsg.Parent := Self;
  pnlMsg.AlignWithMargins := True;
  pnlMsg.Hint := '[Ctrl + C] to copy the message to clipboard';
  pnlMsg.Align := alClient;
  pnlMsg.Caption := 'pnlMsg';
  pnlMsg.ParentBackground := False;
  pnlMsg.ParentColor := True;
  pnlMsg.ParentFont := False;
  pnlMsg.ParentShowHint := False;
  pnlMsg.PopupMenu := pmMsg;
  pnlMsg.ShowHint := True;
  pnlMsg.TabOrder := 1;
  pnlMsg.Styles.Clear;
  pnlMsg.Styles.Add('a {');
  pnlMsg.Styles.Add('  color: #0088cc;');
  pnlMsg.Styles.Add('}');
  pnlMsg.TouchScroll := False;
  pnlMsg.VerticalScrollBar := hsbAuto;
  pnlMsg.HighlightTextColor := 0;
  pnlMsg.EnableSelection := True;

 

hcl overlapped under win10and11.png

Share this post


Link to post

Thanks for the help Alexander.

So I've just tried:

- THtCanvasGDI: I assume this the default so it has the issue.
- THtCanvasGP: Tried `HtDefaultCanvasClass := THtCanvasGP`, and it's the same issue.

- THtCanvasDX: `HtDefaultCanvasClass := THtCanvasDX` solves the issue!

 

And the html code is updated at runtime like this:

`pnlMsg.HTML.Text := aHtmlCode`

 

PS, I prefer `THtCanvasGDI` because the text rendering is the same as the system.

Share this post


Link to post

Oh I thought THtCanvasGDI is the default one...So I tried THtCanvasGDI has no issue.

Question now: I assume changing `HtDefaultCanvasClass` only affects text rendering, but not other parts such as imaging rendering, is that correct?

If so, I can use THtCanvasGDI to workaround the issue...

 

Conclusion: With HCL 3.7 (not sure about the other versions), THtCanvasGP has text overlapping rendering issue, but both THtCanvasGDI and THtCanvasDX are OK.

Share this post


Link to post

This may be related to incorrect font information returned by WinAPI for new fonts in W10/11. AFIR latest HCL versions contains workaround for this.

 

Whole rendering in one control is performed using single canvas class. You can set canvas class separately for each control but they cannot be mixed.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×