1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| unit Unit96;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls,
System.ImageList, Vcl.ImgList;
type
TForm96 = class(TForm)
Button1: TButton;
Panel1: TPanel;
Panel2: TPanel;
ImageList1: TImageList;
procedure Panel1DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
procedure Panel2DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
procedure FormDragDrop(Sender, Source: TObject; X, Y: Integer);
procedure FormDragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
procedure Panel2DragDrop(Sender, Source: TObject; X, Y: Integer);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form96: TForm96;
implementation
{$R *.dfm}
procedure TForm96.FormDragDrop(Sender, Source: TObject; X, Y: Integer);
begin
if Source is TButton then
begin
TButton(Source).Parent:=TForm(Sender);
TButton(Source).Top:=Y;
TButton(Source).Left:=X;
end;
end;
procedure TForm96.FormDragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
Accept:=Source is TButton;
end;
procedure TForm96.Panel1DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
Accept:=False;
end;
procedure TForm96.Panel2DragDrop(Sender, Source: TObject; X, Y: Integer);
begin
if Source is Tbutton then
begin
TButton(Source).Parent:=TPanel(Sender);
TButton(Source).Top:=Y;
TButton(Source).Left:=X;
end;
end;
procedure TForm96.Panel2DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
Accept:=Source is Tbutton;
end;
end. |
Partager