Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #22  
Antiguo 18-02-2004
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Poder: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
Vamos a ver:

Ayer hice algo así:

Código:
unit Element;

interface

uses
  Windows, Classes;

type
  TPoints = array of TPoint;
  TElement = class(TComponent)
  private
    FPoints: TPoints;
    procedure SetPoints(const Value: TPoints);

    procedure ReadPoints(Reader: TReader);
    procedure WritePoints(Writer: TWriter);

  protected
    procedure DefineProperties(Filer: TFiler); override;

  public
    property Points: TPoints read FPoints write SetPoints;
  end;

procedure Register;

implementation

{ TElement }

procedure TElement.DefineProperties(Filer: TFiler);
begin
  inherited;

  Filer.DefineProperty('Points', ReadPoints, WritePoints, Length(FPoints) > 0);
end;

procedure TElement.ReadPoints(Reader: TReader);
var
  I: Integer;

begin
  Reader.ReadListBegin;
  I := 0;
  while not Reader.EndOfList do
  begin
    SetLength(FPoints, I + 1);
    FPoints[i].X := Reader.ReadInteger;
    FPoints[i].Y := Reader.ReadInteger;
    Inc(I);
  end;
  Reader.ReadListEnd;
end;

procedure TElement.SetPoints(const Value: TPoints);
begin
  FPoints := Copy(Value);
end;

procedure TElement.WritePoints(Writer: TWriter);
var
  I: Integer;

begin
  for I := 0 to Length(FPoints) - 1 do
  begin
    Writer.WriteInteger(FPoints[i].X);
    Writer.WriteInteger(FPoints[i].Y);
  end;
end;

procedure Register;
begin
  RegisterComponents('Samples', [TElement]);
end;

end.
Entonce no estaba tan errado. Claro que es mejor usar como tú un contador de los puntos.

// Saludos
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 12:50:48.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi