#1 2014-03-02 22:29:17

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Canvas problem

Hi,

I have a strange problem with FillRect function. This is the code:

      lPdf.VCLCanvas.Font.Name := fname;
      lPdf.VCLCanvas.Font.Size := foSmall;
      lPdf.VCLCanvas.Font.Style := [];
      lPdf.VCLCanvas.Font.Color := clBlack;
      lPdf.VCLCanvas.Pen.Width := 2;
      lPdf.VCLCanvas.Pen.Color := clGray;
      lPdf.VCLCanvas.Brush.Style := Vcl.Graphics.bsClear;
      lPdf.VCLCanvas.Brush.Color := clRed;
      rt := Rect(100, vpos, lPdf.VCLCanvasSize.cx-100, vpos +20);
      lPdf.VCLCanvas.FillRect(rt);
      lPdf.VCLCanvas.MoveTo(100, vpos);
      lPdf.VCLCanvas.LineTo(100, vpos+20);
      lPdf.VCLCanvas.MoveTo(100, vpos+20);
      lPdf.VCLCanvas.LineTo(lPdf.VCLCanvasSize.cx-100, vpos+20);

This code draw 2 lines and a red fill rectangle. However I see only the fill rectangle. If I remove lPdf.VCLCanvas.FillRect(rt); from code I can see the lines.

I don't understand why? I should see the line over the fill rectangle.

Last edited by array81 (2014-03-03 13:04:46)

Offline

#2 2014-03-03 13:05:50

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Canvas problem

The same code works very well on TPaintBox canvas.

  PaintBox1.Canvas.Pen.Width := 2;
  PaintBox1.Canvas.Pen.Color := clGray;
  PaintBox1.Canvas.Brush.Style := Vcl.Graphics.bsClear;
  PaintBox1.Canvas.Brush.Color := clRed;
  rt := Rect(100, 100, 200, 100 +20);
  PaintBox1.Canvas.FillRect(rt);
  PaintBox1.Canvas.MoveTo(100, 100);
  PaintBox1.Canvas.LineTo(100, 100+20);
  PaintBox1.Canvas.MoveTo(100, 100+20);
  PaintBox1.Canvas.LineTo(200, 100+20);

Do you have any idea?

Offline

Board footer

Powered by FluxBB