Recent

Author Topic: (Solved)Paint question  (Read 806 times)

JLWest

  • Hero Member
  • *****
  • Posts: 1293
(Solved)Paint question
« on: October 06, 2020, 11:47:54 pm »
I have a panel on the form located at

Panel1.Top = 450
Panel1.left = 6
Panel1.Width = 104
Panel1.Height = 31
So to paint a border around the panel I do the following.

{Panel1}
 R.Left := 6;       R.Right := 688;      {R.Right := R.Left + Panel1.Width}
 R.Top := 450;    R.Bottom := 500;   {R.Bottom := R.Top + Panel1.Height}
 Canvas.Rectangle(R); 

Wondering if there isn't someway to do:

Canvas.Rectangle(R,Panel1);  Which didn't work.
 


                       
« Last Edit: October 10, 2020, 04:35:30 am by JLWest »
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Paint question
« Reply #1 on: October 07, 2020, 12:11:16 am »
Hi!

You are painting exact below the Panel!

Code: Pascal  [Select][+][-]
  1. Uses .... Types;
  2. ...
  3. var R : Trect;
  4. ....
  5. //R:= Panel.ClientRect; // WRONG
  6. R := Panel.BoundsRect ;
  7. InflateRect(R,2,2);
  8. Canvas.Pen.Color := clRed;
  9. Canvas.Rectangle(R);
  10. ....
  11.  

Wish you nice rectangle!

Winni
« Last Edit: October 07, 2020, 12:18:05 am by winni »

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Paint question
« Reply #2 on: October 07, 2020, 12:57:36 am »
Works Great; Thankn Winni
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

 

TinyPortal © 2005-2018