Recent

Author Topic: ERROR IN PEN (FINDKEY)  (Read 920 times)

carlosnatal

  • Newbie
  • Posts: 1
ERROR IN PEN (FINDKEY)
« on: October 09, 2019, 05:23:46 pm »
Under Linux, try draw three triangles in a panel canvas using the same coordinates and different pen color.

Thaddy

  • Hero Member
  • *****
  • Posts: 14382
  • Sensorship about opinions does not belong here.
Re: ERROR IN PEN (FINDKEY)
« Reply #1 on: October 09, 2019, 07:53:53 pm »
I think this is a troll, but anyway....<sigh>
Under Linux, try draw three triangles in a panel canvas using the same coordinates and different pen color.
So? That works. Show code that proves otherwise....
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormPaint(Sender: TObject);
  2. begin
  3.   form1.Canvas.Pen.Color := clBlue;
  4.   form1.Canvas.Line( 2, 100, 50,2);
  5.   form1.Canvas.Line( 2, 100, 150,2);
  6.   form1.Canvas.Line( 50, 2, 150,2);
  7.   form1.Canvas.Pen.Color := clRed;
  8.   form1.Canvas.Line( 20, 120, 70,20);
  9.   form1.Canvas.Line( 20, 120, 170,20);
  10.   form1.Canvas.Line( 70, 20, 170,20);
  11.   form1.Canvas.Pen.Color := clGreen;
  12.   form1.Canvas.Line( 40, 140, 90,40);
  13.   form1.Canvas.Line( 40, 140, 190,40);
  14.   form1.Canvas.Line( 90, 40, 190,40);
  15. end;
 

What you suggest is overwriting, so in the above example you would end up with green...
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormPaint(Sender: TObject);
  2. begin
  3.     form1.Canvas.Pen.Color := clBlue;
  4.     form1.Canvas.Line( 2, 100, 50,2);
  5.     form1.Canvas.Line( 2, 100, 150,2);
  6.     form1.Canvas.Line( 50, 2, 150,2);
  7.     form1.Canvas.Pen.Color := clRed;
  8.     form1.Canvas.Line( 2, 100, 50,2);
  9.     form1.Canvas.Line( 2, 100, 150,2);
  10.     form1.Canvas.Line( 50, 2, 150,2);
  11.     form1.Canvas.Pen.Color := clGreen;
  12.     form1.Canvas.Line( 2, 100, 50,2);
  13.     form1.Canvas.Line( 2, 100, 150,2);
  14.     form1.Canvas.Line( 50, 2, 150,2);
  15. end;

BTW: Linux has nothing to do with it....
« Last Edit: October 09, 2019, 08:41:41 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

 

TinyPortal © 2005-2018