PDA

View Full Version : سوال: Self.BoundsRect چیست؟



saeed729
شنبه 28 اردیبهشت 1392, 20:47 عصر
سلام دوستان

کاربرد Self.BoundsRect چیست؟

با تشکر.

یوسف زالی
شنبه 28 اردیبهشت 1392, 21:16 عصر
سلام.


Specifies the bounding rectangle of the control, expressed in the coordinate system of the parent control.



R := Control.BoundsRect; //Delphi example

correspond to

R.Left := Control.Left; //Delphi example
R.Top := Control.Top;
R.Right := Control.Left + Control.Width;
R.Bottom := Control.Top + Control.Height;


چهارچوب یک کنترل رو در قالب یک رکورد Rectangle برمی گردونه.

SayeyeZohor
شنبه 28 اردیبهشت 1392, 23:11 عصر
با اجازه دوستم

procedure TForm1.Button1Click(Sender: TObject);
var
R: TRect;
begin
R := Button1.BoundsRect; //Delphi example

//correspond to

R.Left := Button1.Left; //Delphi example
R.Top := Button1.Top;
R.Right := Button1.Left + Button1.Width;
R.Bottom := Button1.Top + Button1.Height;

PopupMenu1.Popup(R.Top, R.Left);
end;

یوسف زالی
یک شنبه 29 اردیبهشت 1392, 00:04 صبح
بله. اما در حقیقت وقتی این روش رو به کار می برند که معمولا با Canvas سروکار دارند و می خوان دستوراتی مثل CopyRect رو اجرا کنن.