Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #5  
Antiguo 28-05-2022
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.210
Poder: 22
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
Puedes crear el label asi:
Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var
  newImage: TImage;
  newLabel: TLabel;
begin
  newImage:= Timage.Create(Image1);
  with newImage do
  begin
    picture := Image1.picture;
    name := 'MS_' + inttostr(nmesas);
    nmesas := nmesas + 1;
    Stretch := True;
    Parent := Panel1;
    Left := 10;
    Top := 10;
    height := 57;
    width := 61;
    Transparent := true;
    onMouseDown := Image1MouseDown;
    onMouseMove := Image1MouseMove;
    onMouseUp := Image1MouseUp;
    onDblClick := Image1DblClick;
  end;
  newLabel:= TLabel.Create(self);
  with newLabel do
  begin
    name:= 'L'+newImage.Name;
    Left:= newImage.Left;
    Top := newImage.Top + newImage.Height + 10;
    Caption:= newImage.Name;
    Parent:= Panel1;
  end;
end;


Y luego puedes moverlo así:
Código Delphi [-]
procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var
  Lab: TLabel;
begin
  if Capturing then begin
    TImage(Sender).Left := TImage(Sender).Left - (MouseDownSpot.x - x);
    TImage(Sender).Top := TImage(Sender).Top - (MouseDownSpot.y - y);

    StatusBar1.Panels[0].Text := IntToStr(TImage(Sender).Left) + ' - ' + IntToStr(TImage(Sender).Top);
    TImage(Sender).Hint := StatusBar1.Panels[0].Text;
    TImage(Sender).ShowHint := True;

    Lab:= FindComponent('L'+TImage(Sender).Name) as TLabel;
    Lab.Left:=  TImage(Sender).Left;
    Lab.Top:=  TImage(Sender).Top + TImage(Sender).Height + 10;
  end;
end;



Saludos.
Responder Con Cita
 



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

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Drag Drop JuanOrtega Varios 9 16-04-2014 08:00:31
Drag and Drop... dvlt .NET 0 07-02-2008 09:42:59
Drag&Drop sobre un Form gluglu OOP 2 13-07-2007 19:18:20
Drag & Drop DanForever Varios 2 01-06-2006 14:24:25
Drag & Drop cone220 Varios 1 26-05-2003 19:06:34


La franja horaria es GMT +2. Ahora son las 12:34:31.


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