Tengo un Shape en forma de circulo y un panel en mi forma principal. Lo que quiero hacer es una especie de arrastre de tal modo que cuando suelte el boton del mouse se cree un nuevo Shape, tambien en forma de circulo, es código que tengo implementado hasta ahora es este:
- Código: Seleccionar todo
- void __fastcall TForm1::FormResize(TObject *Sender)
- {
- Panel1->Height = Form1->ClientHeight;
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Shape2DragOver(TObject *Sender, TObject *Source,
- int X, int Y, TDragState State, bool &Accept)
- {
- Accept = True;
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Shape2DragDrop(TObject *Sender, TObject *Source,
- int X, int Y)
- {
- TShape *place = (TShape *)Source;
- TPanel *red = (TPanel *)Sender;
- // Estoy intentando hacer esto pero para crear el nuevo Shape pero no me funciona
- TShape *lugar = new TShape(this);
- lugar->Shape = stCircle;
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Shape2StartDrag(TObject *Sender,
- TDragObject *&DragObject)
- {
- Label3->Caption = "Starting the drag...";
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Shape2EndDrag(TObject *Sender, TObject *Target,
- int X, int Y)
- {
- Label3->Caption = "Finishing the drag...";
- }
Les agradezco mucho su ayuda.
Una cosa mas, podrian recomendarme alguna página para estudiar sobre como arrastrar y soltar objetos y para crear objetos dinamicamente? Muchas gracias.


