4
votes

I'm working with a TMemo component to display some text in a limited space. Currently it's using a truetype font which doesn't ship with windows and is installed by the app when it runs.

On my PC (Running Windows XP), the spacing between each line of text seems to be about eight pixels. On a different PC running Windows 7, the line spacing seems to be about 14 pixels, which is pushing the bottom row of text out of visibility on the memo.

So, My question is really this:

  1. Is this caused by the different versions of Windows? It's all I could think that was different.
  2. Is there some way I can adjust this value so it would be consistent across all instances of the application, wherever it was running?

Alternatatively, is there a different component I could use which might let me tweak this value?

2
The TMemo is just a wrapper for a standard Windows control. Hence, it is not written in Delphi. Basically, TMemo just tells the operating system "hey, can you place one of your cool multiline edit controls at these coordinates?". So a more appropriate title would have been "In Windows, is there a way..."Andreas Rejbrand
I'm coding in Delphi, using TMemo. If I'd said, "In Windows, is there a way..." I'd likely have recieved code in C++.Kieran
Nope, you're right, it's not; but again, I'm coding this in Delphi using TMemo - there may be an approach using TMemo that I wasn't aware of, rather than via using Windows API calls. That's the question I was asking.Kieran

2 Answers

2
votes

TMemo is a descendent of Windows Common controls and it's behavior depends on current Windows configuration so it is natural to get different results with it.

If you just want to display some information it's better to use components which let you set texts positions and their style precisely like TRichView. This component is not free but it has it's own text rendering engine and let you style texts with CSS like selectors which look the same in different versions of windows.

1
votes

In addition to Mohsen's answer I'd like to mention LMD ElPack and it's ElEdit component which also has it's own text rendering engine. Unlike TRichView ElEdit is a plain text edit / memo component, so it's a drop-in replacement for TEdit / TMemo. And line height is configurable there