Sign in Join

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

Mailing lists / lazarus / 2014-04

Custom GraphicsControl - need Canvas to set Height outside OnPaint

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Petr Kristan

Hi.

I'am creating an graphics control and I need Canvas to set control Height. But I can draw (access to Canvas) only in OnPaint event.

How to solve this problem?

Thanks
Petr

Petr Kristan . EPOS PRO s.r.o., Smilova 333, 530 02 Pardubice tel: +420 461101401 Czech Republic (Eastern Europe) fax: +420 461101481

Reply by email

zeljko
to Petr Kristan
Petr Kristan wrote 6 lines
Hi. I'am creating an graphics control and I need Canvas to set control Height. But I can draw (access to Canvas) only in OnPaint event. How to solve this problem?

You need to set height of control by calculating text height out of paint event ? I'm using TBitmap for such measurements. Create bitmap, assign control font to bmp canvas, measure.

z.

Reply by email

Vojtěch Čihák
to Petr Kristan: Hi. I'am creating an graphics control and I need Canvas to set control Height. But I can…

Hi,
?
you can do measurement in overriden CreateWnd, Canvas already exists there. ?
Blaazen?
______________________________________________________________

Show quoted text 5 lines
Od: Petr Kristan Komu: Datum: 07.04.2014 11:03 P?edm?t: [Lazarus] Custom GraphicsControl - need Canvas to set Heightoutside OnPaint

Hi.

I'am creating an graphics control and I need Canvas to set control Height. But I can draw (access to Canvas) only in OnPaint event.

How to solve this problem?

Thanks
Petr

Petr Kristan . EPOS PRO s.r.o., Smilova 333, 530 02 Pardubice tel: +420 461101401 ? ?Czech Republic (Eastern Europe) fax: +420 461101481 --

Reply by email

Petr Kristan
to zeljko: You need to set height of control by calculating text height out of paint event ? I'm…
zeljko wrote 11 lines
On 04/07/2014 11:01 AM, Petr Kristan wrote: >Hi. > >I'am creating an graphics control and I need Canvas to set control >Height. But I can draw (access to Canvas) only in OnPaint event. > >How to solve this problem? You need to set height of control by calculating text height out of paint event ? I'm using TBitmap for such measurements. Create bitmap, assign control font to bmp canvas, measure.

Tanks for fast helpfull responses.

Petr

Petr Kristan . EPOS PRO s.r.o., Smilova 333, 530 02 Pardubice tel: +420 461101401 Czech Republic (Eastern Europe) fax: +420 461101481

Reply by email