printpreview with drawtext method ?

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

printpreview with drawtext method ?

Postby dav999 » June 27th, 2005, 10:56 am

Hello

in delphi for center a text in table, i use the Printer.DrawText method, but is missed in your great control :(

how i can use a method as implemented in tprintpreview, for center a text in a "virtual box" (for creating a table), but i would not use a rtf file/richedit control.

Thanks
David

ps : excuse for my poor english, but if anyone speak french :)
dav999
Active Member
Active Member
 
Posts: 14
Joined: October 7th, 2003, 3:04 pm

Postby Kambiz » June 27th, 2005, 11:32 am

Which version of Delphi are you using? From D1 to D7 there's no DrawText method for the Printer object.

Anyway, you can use DrawText function of Windows API for your purpose.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2405
Joined: March 7th, 2003, 7:10 pm

Postby dav999 » June 27th, 2005, 11:43 am

Sorry

i work with Delphi 6 Pro and Xp SP1a

i have tested with this code but it's not good :
Code: Select all
drawtext(frm_depart.print.Handle,pchar('Clt'),length('Clt'),rect,DT_VCENTER or DT_CENTER);


edit :
ok i have seen my error, i have missed the canevas property in my previous line, the good line is :
Code: Select all
drawtext(frm_depart.print.Canvas.Handle,pchar('Clt'),length('Clt'),rect,DT_VCENTER or DT_CENTER);



Thx
David
Last edited by dav999 on June 27th, 2005, 2:11 pm, edited 1 time in total.
dav999
Active Member
Active Member
 
Posts: 14
Joined: October 7th, 2003, 3:04 pm

Postby Kambiz » June 27th, 2005, 1:33 pm

So, you can do the same with canvas of PrintPreview:

Code: Select all
drawtext(PrintPreview.Canvas.Handle, 'Clt', -1, rect, DT_VCENTER or DT_CENTER);
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2405
Joined: March 7th, 2003, 7:10 pm

Postby dav999 » June 27th, 2005, 2:10 pm

Yes i have seen :roll: , i use this in my 2nd line of the previous message

Thx
David
dav999
Active Member
Active Member
 
Posts: 14
Joined: October 7th, 2003, 3:04 pm


Return to DELPHI AREA Products

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron