TPrintPreview newbie questions

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

TPrintPreview newbie questions

Postby martinj » October 21st, 2008, 9:41 am

i have plans to migrate to TPrintPreview from GMPrintSuite due to non existance of GMPrintSuite version for BDS2007, but i have a few problems..

first, zoom...

Code: Select all
  PrintPreview1.BeginDoc;
  PrintPreview1.Canvas.TextOut(100, 300, 'some string');
  PrintPreview1.EndDoc;


after that, i put PrintPreview.Zoom := 150; in onClick event of PrintPreview. When i click on it, there's just blank page... not any text on it...

i called refresh and repaint, but still nothing...

How to show text after zoom in/out?

2nd question is about writing text in a rect.
i used textRect function

Code: Select all
 
  r.Top := 100;
  r.Left := 100;
  r.Bottom := 1000;
  r.Right := 1000;


  PrintPreview1.BeginDoc;
  PrintPreview1.Canvas.TextRect(r, 100, 300, s);
  PrintPreview1.EndDoc;


s is a string with length about 300 characters but i see only first 30-40. is there a way to write long and wrapped text?

3rd is about drawing lines...

i tried with this

Code: Select all
 
  r.Top := 100;
  r.Left := 100;
  r.Bottom := 1000;
  r.Right := 1000;

  PrintPreview1.Canvas.Pen.Style := psSolid;
  PrintPreview1.Canvas.Pen.Width := 10;

  PrintPreview1.BeginDoc;
  PrintPreview1.Canvas.Rectangle(r.Top, r.Left, r.Bottom, r.Right);
  PrintPreview1.Canvas.TextOut(100, 300, s);
  PrintPreview1.EndDoc;


when i call preview, rectangle goes over text and text under it is not visible... is there a solution for that?

thnx in advance
Martin Jeremic
AGTim
www.agtim.com
martinj
Member
Member
 
Posts: 3
Joined: May 14th, 2007, 10:36 am

Postby Kambiz » October 21st, 2008, 5:12 pm

I guess all problems are because of not considering the measurement unit (Units property).

All values you pass to Canvas methods are in unit specified by the Units property. For example, when Units property is set to mmHiMetric, 1000 units is equal to 10mm.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby martinj » October 22nd, 2008, 8:37 am

units are set to mmLoMetric everywhere.
martinj
Member
Member
 
Posts: 3
Joined: May 14th, 2007, 10:36 am

Postby Kambiz » October 22nd, 2008, 5:04 pm

Please attach a small program, otherwise I cannot figure out what's wrong in your code.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 3 guests

cron