放上一个image(在上面画你的标题栏)
type
TForm1 = class(TForm)
Image1: TImage;
procedure Image1MouseMove(Sender: TObject;
Shift: TShiftState;
X,
Y: Integer);
procedure Image1MouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
private
{ Private declarations }
ylx,yly:integer;
//定义两个全局变量
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Image1MouseMove(Sender: TObject;
Shift: TShiftState;
X,
Y: Integer);
begin
if ssleft in shift then
begin
//按下鼠标左键拖动form1
left:=left+x-ylx;
top:=top+y-yly;
end;
end;
procedure TForm1.Image1MouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
begin
Ylx:=x;
//记录鼠标原来的坐标值
Yly:=y;
end;