Board index » delphi » PaintBox.Canvas.Rectangle

PaintBox.Canvas.Rectangle

I use Delphi 3.0.
I have the following problem:

In PaintBox OnPaint event handler i write

with PaintBox.Canvas do begin
  Pen.Width := 4;
  Rectangle(0, 0, PaintBox.Width, PaintBox.Height);
end;

but  left and top side of Rectangle was drawn with only 1pixel Width
Why ?

 

Re:PaintBox.Canvas.Rectangle


On Fri, 27 Mar 1998 14:56:11 +0200, "Octavian Dan"

Quote
<ep-...@djx.topedge.com> wrote:
> Why ?

The coordinate/drawing system in Microsoft Windows is somewhat strange
and takes some getting used to... I suggest you purchase and read
Charles Petzold's _Programming Windows '95_ if you are interested in
learning more about this.

The reason for the behavior you've described is that you've assumed
Microsoft Windows draws pen lines on the interior of the rectangle,
but in fact the behavior is different. This code will show you what I
mean:

  with PaintBox1.Canvas do begin
    Pen.Width := 4;
    Rectangle(6, 6, PaintBox1.Width - 2, PaintBox1.Height - 2);
  end;

--
Rick Rogers (TeamB) | Fenestra Technologies

Other Threads