Ik wil weten waar een tcomponent(zoals een panel) relatief op het scherm bevind in pixels . Dus niet relatief tot het parent form.
Volgens mij moet je dan eerst bepalen waar het Parent-Form zich bevindt op het scherm en daarna bepaal je waar de TComponent zich bevindt in het Parent-Form. Vervolgens klein rekensommetje toch?
Ik pas in mijn jas. Mijn jas past in mijn tas. Dus ik pas in mijn tas.
dat met een while lus en dan steeds .parent gaat niet werken . Dat komt door dat alles in een 'schil' zit hier op het werk die niet luisterd naar TWincontrol van de .parent. Ik moet dus echt iets anders verzinnen
Ik had dit verzonnen:
var
c : TWinControl;
begin
c := aPanel.Parent;
while c.Parent <> nil do
c := c.Parent;
end;
Ik had dit verzonnen:
var
c : TWinControl;
begin
c := aPanel.Parent;
while c.Parent <> nil do
c := c.Parent;
end;
Uit de help (TControl):
Translates a given point from client area coordinates to global screen coordinates.
function ClientToScreen(const Point: TPoint): TPoint;
Description
Use ClientToScreen to convert a point whose coordinates are expressed locally to the control to the corresponding point in screen coordinates. In client area coordinates (0, 0) corresponds to the upper left corner of the control's client area. In screen coordinates (0, 0) corresponds to the upper left corner of the screen.
Use ScreenToClient along with ClientToScreen to convert from one control's coordinate system to another control's coordinate system. For example,
P := TargetControl.ScreenToClient(SourceControl.ClientToScreen(P));
converts P from coordinates in SourceControl to coordinates in TargetControl.
Translates a given point from client area coordinates to global screen coordinates.
function ClientToScreen(const Point: TPoint): TPoint;
Description
Use ClientToScreen to convert a point whose coordinates are expressed locally to the control to the corresponding point in screen coordinates. In client area coordinates (0, 0) corresponds to the upper left corner of the control's client area. In screen coordinates (0, 0) corresponds to the upper left corner of the screen.
Use ScreenToClient along with ClientToScreen to convert from one control's coordinate system to another control's coordinate system. For example,
P := TargetControl.ScreenToClient(SourceControl.ClientToScreen(P));
converts P from coordinates in SourceControl to coordinates in TargetControl.
We adore chaos because we like to restore order - M.C. Escher