La teoria
Lepe es la siguiente:
BringToFront llama a la funcion SetZOrder
Código Delphi
[-]
procedure TControl.BringToFront;
begin
SetZOrder(True);
end;
La función SetZOrder llama a SetZOrderPosition
Código Delphi
[-]
procedure TControl.SetZOrder(TopMost: Boolean);
begin
if FParent <> nil then
if TopMost then
SetZOrderPosition(FParent.FControls.Count - 1) else
SetZOrderPosition(0);
end;
Y SetZOrderPosition cambia la posicion del control dentro de la lista de controles:
Código Delphi
[-]
procedure TControl.SetZOrderPosition(Position: Integer);
var
I, Count: Integer;
ParentForm: TCustomForm;
begin
if FParent <> nil then
begin
I := FParent.FControls.IndexOf(Self);
if I >= 0 then
begin
Count := FParent.FControls.Count;
if Position < 0 then Position := 0;
if Position >= Count then Position := Count - 1;
if Position <> I then
begin
FParent.FControls.Delete(I);
FParent.FControls.Insert(Position, Self);
InvalidateControl(Visible, True);
if not (csLoading in ComponentState) then
begin
ParentForm := ValidParentForm(Self);
if csPalette in ParentForm.ControlState then
TControl(ParentForm).PaletteChanged(True);
end;
end;
end;
end;
end;
¿Lo ves ahora?
![Confused](http://www.clubdelphi.com/foros/images/smilies/confused.gif)