Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-11

Center text in multi-line hints?

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Donald Ziesig

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).

Thanks,

Don Ziesig

Reply by email

Ondrej Pokorny
to Donald Ziesig
Donald Ziesig wrote 10 lines
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

Reply by email