unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
procedure Bewegen(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var MyEdit: TEdit;
begin
MyEdit := TEdit.Create(Form1);
with MyEdit
do begin
Parent := Form1;
Name := '
Edit1';
Left := 50;
Top := 50;
OnMouseDown:= Bewegen;
end;
end;
procedure TForm1.Bewegen(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
const sc_dragmove = $f012;
begin
ReleaseCapture;
TEdit(Sender).perform(wm_syscommand,sc_dragmove, 0);
end;
end.