[Lazarus] Center text in multi-line hints?

Ondrej Pokorny lazarus at kluug.net
Wed Nov 15 20:41:06 CET 2017


On 15.11.2017 18:46, Donald Ziesig via Lazarus wrote:
> Hi All!
>
> This is just a minor annoyance fpr me (it grates on my sense of 
> esthetics :-)), but is there any way to center the text in a 
> multi-line hint?  In the current app, the hint is for a TPaintBox, but 
> I've occasionally wanted to do this for other controls in the past.
>
> I could almost do this by pre-processing the hint text, but it would 
> not take into account even/odd character counts (better than nothing, 
> but not optimal).

Paint the hint yourself with DrawText: 
https://msdn.microsoft.com/cs-cz/library/windows/desktop/dd162498(v=vs.85).aspx 
- no need to preprocess the text.

Lazarus has implemented DrawText for all widgetsets. You can also use 
TCanvas.TextRect with the Style parameter.

Ondrej


More information about the Lazarus mailing list