Page 1 of 1

TPrintPreview newbie questions

PostPosted: October 21st, 2008, 9:41 am
by martinj
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

PostPosted: October 21st, 2008, 5:12 pm
by Kambiz
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.

PostPosted: October 22nd, 2008, 8:37 am
by martinj
units are set to mmLoMetric everywhere.

PostPosted: October 22nd, 2008, 5:04 pm
by Kambiz
Please attach a small program, otherwise I cannot figure out what's wrong in your code.