formatting

git-svn-id: trunk@18518 -
This commit is contained in:
paul 2009-01-31 13:11:39 +00:00
parent 68603b956b
commit f6ffc3b079

View File

@ -123,21 +123,25 @@ var
ParentForm: TCustomForm;
Parent: TWinControl;
begin
if Component is TControl then begin
ParentForm:=GetParentForm(TControl(Component));
Parent:=TControl(Component).Parent;
if (Parent=nil) or (ParentForm=nil) then begin
Result:=Point(0,0);
end else begin
Result:=Parent.ClientOrigin;
FormOrigin:=ParentForm.ClientOrigin;
if Component is TControl then
begin
ParentForm := GetParentForm(TControl(Component));
Parent := TControl(Component).Parent;
if (Parent = nil) or (ParentForm = nil) then
begin
Result := Point(0, 0);
end else
begin
Result := Parent.ClientOrigin;
FormOrigin := ParentForm.ClientOrigin;
//DebugLn(['GetParentFormRelativeTopLeft Component=',dbgsName(Component),' Parent=',dbgsName(Parent),' ',dbgs(Result),' ParentForm=',dbgsName(ParentForm),' ',dbgs(FormOrigin)]);
Result.X:=Result.X-FormOrigin.X+TControl(Component).Left;
Result.Y:=Result.Y-FormOrigin.Y+TControl(Component).Top;
Result.X := Result.X - FormOrigin.X + TControl(Component).Left;
Result.Y := Result.Y - FormOrigin.Y + TControl(Component).Top;
end;
end else begin
Result.X:=LongRec(Component.DesignInfo).Lo;
Result.Y:=LongRec(Component.DesignInfo).Hi;
end else
begin
Result.X := LongRec(Component.DesignInfo).Lo;
Result.Y := LongRec(Component.DesignInfo).Hi;
end;
end;