Ver Mensaje Individual
  #4  
Antiguo 18-02-2015
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 38
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola shoulder.

Te pongo una idea que tal vez te simplifique el mostrado:
Código Delphi [-]
unit Unit2;

interface

uses Classes,StdCtrls, ExtCtrls;

type
  TLabeledImage = class(TImage)
  private
    FLabel: TLabel;
  protected
    procedure Paint; override;
  public
    constructor Create(AOwner: TComponent); override;
    property aLabel: TLabel read FLabel write FLabel;
  end;

implementation

constructor TLabeledImage.Create(AOwner: TComponent);
begin
  inherited;
  FLabel:= TLabel.Create(Self);
end;

procedure TLabeledImage.Paint;
begin
  inherited;
  FLabel.Left:= Left + (Width-FLabel.Width) shr 1;
  FLabel.Top := Top + Height + 5;
  FLabel.Parent:= Parent;
end;
end.

Prueba:
Código Delphi [-]
...
uses Jpeg, Unit2;

procedure TForm1.btnShowClick(Sender: TObject);
var
  lbimg: TLabeledImage;
  i,j,x,y: Integer;
begin
  y:= 10;
  for i:= 1 to 3 do
  begin
    x:= 10;
    for j:= 1 to 4 do
    begin
      lbimg:= TLabeledImage.Create(Self);
      lbimg.Picture.LoadFromFile('delphi.jpg');
      lbimg.aLabel.Caption:= 'delphi.jpg';
      lbimg.Width := 120;
      lbimg.Height:= 120;
      lbimg.Left  := x;
      lbimg.Top   := y;
      lbimg.Stretch:= True;
      lbimg.Parent := ScrollBox1;
      Inc(x, lbimg.Width + 10);
    end;
    Inc(y, lbimg.Height + lbimg.aLabel.Height + 10);
  end;
end;

Muestra:


En las pruebas funcionó bién, pero hice el código sobre la marcha, así que seguramente podrás mejorarlo con algunos ajustes.

Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....

Última edición por ecfisa fecha: 18-02-2015 a las 19:01:05.
Responder Con Cita