Lazarus
Free Pascal => Beginners => Topic started by: JLWest on October 06, 2020, 11:47:54 pm
Title:
(Solved)Paint question
Post by:
JLWest
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.
Title:
Re: Paint question
Post by:
winni
on
October 07, 2020, 12:11:16 am
Hi!
You are painting exact below the Panel!
Code: Pascal
[Select]
[+]
[-]
Uses
....
Types
;
...
var
R
:
Trect
;
....
//R:= Panel.ClientRect; // WRONG
R
:
=
Panel
.
BoundsRect
;
InflateRect
(
R
,
2
,
2
)
;
Canvas
.
Pen
.
Color
:
=
clRed
;
Canvas
.
Rectangle
(
R
)
;
....
Wish you nice rectangle!
Winni
Title:
Re: Paint question
Post by:
JLWest
on
October 07, 2020, 12:57:36 am
Works Great; Thankn Winni
TinyPortal
© 2005-2018