Recent

Author Topic: [SOLVED]Draw Rectangle on Printer.Canvas?  (Read 2523 times)

Gary Randall

  • Jr. Member
  • **
  • Posts: 70
[SOLVED]Draw Rectangle on Printer.Canvas?
« on: June 15, 2016, 06:49:14 pm »
I'm trying to draw a rectangle with a heavy line weight on my Printer.Canvas but I only get  one pixel wide lines with the following code.  Isn't the line weight set by the Pen.Width?  The result is the same whether I use Rectangle, Frame, or individual MoveTo and LineTo commands.  Bug, undocumented feature, or my bad?

Code: Pascal  [Select][+][-]
  1. [
  2.         Printer.Canvas.Pen.Cosmetic := False;
  3.         Printer.Canvas.Pen.Width := 4;
  4.         Printer.Canvas.Pen.Color := clBlack;
  5.         Printer.Canvas.Frame(DstTopLt.x, DstTopLt.y, DstBotRt.x, DstBotRt.y);
  6. ]
  7.  
  8.  
« Last Edit: June 15, 2016, 09:58:04 pm by Gary Randall »
Windows 7 Home Premium 64 bit - SP 1
Lazarus Version #: 1.8.0; FPC Version: 3.0.4
SVN Revision 56594
i386-win32-win32/win64

rvk

  • Hero Member
  • *****
  • Posts: 6711
Re: Draw Rectangle on Printer.Canvas?
« Reply #1 on: June 15, 2016, 07:12:32 pm »
Works for me (Laz1.6 FPC 3.0).

Did you try 2 rectangles besides each other and one with width := 1 and one with width := 4; (or 40) and see if it makes a difference.

Width := 4 isn't really a heavy line considering some printers print at 600 or 1200 dpi.

(I had to zoom in 800% for this example)
« Last Edit: June 15, 2016, 07:14:27 pm by rvk »

Gary Randall

  • Jr. Member
  • **
  • Posts: 70
Re: Draw Rectangle on Printer.Canvas?
« Reply #2 on: June 15, 2016, 09:56:40 pm »
Aww!  Don't know what I was thinking.  I'm printing to a PDFCreator virtual printer with a scale factor of 6.25.  That corresponds to a width of 25.  Once I applied the scale factor it worked.  Thanks for the help rvk!
Windows 7 Home Premium 64 bit - SP 1
Lazarus Version #: 1.8.0; FPC Version: 3.0.4
SVN Revision 56594
i386-win32-win32/win64

 

TinyPortal © 2005-2018