Ver Mensaje Individual
  #2  
Antiguo 20-02-2022
Avatar de bulc
bulc bulc is offline
Miembro
 
Registrado: jun 2010
Posts: 416
Reputación: 15
bulc Va por buen camino
Resuelto

Apunto la solución. He creado un Array de TPoint y otro de TStaticText que se cargan en el evento onCreateForm
Código Delphi [-]
procedure TForm1.BtSTMoveClick(Sender: TObject);
// Variables Globales STx_A0 => TPoint; ST_A => TStaticText.
Var
  Aux : TPoint ; Par1, Par2, N, I, IAzar : Integer;  S :String;
begin
S := '';
Repeat
    IAzar := Random(8) + 1 ;
    if Pos(IntToStr(IAzar), S ) = 0 then
       Insert( IntToStr(IAzar), S, Length(S) + 1) ;
Until Length(S) = 8   ;
   Edit1.Text := S;  // Muestra la serie de 8 digitos alfanum.
  // Código de intercambio de posiciones de los TStaticText según serie S
  for I := 1 to 4 do
    begin
     N := I + 4;
     Par1:= StrToInt(S[i] ); Par2:=  StrToInt(S[N] );
     Aux.X :=ST_A[Par1].Left;    Aux.Y :=ST_A[Par1].Top;
     ST_A[Par1].Left :=  ST_A[Par2].Left   ;
     ST_A[Par1].Top :=  ST_A[Par2].Top   ;
     ST_A[Par2].Left := Aux.X ;
     ST_A[Par2].Top := Aux.Y ;
    end;
end;

Última edición por Casimiro Notevi fecha: 20-02-2022 a las 22:15:12.
Responder Con Cita