怎么实现拖动form上的一个image时,让form跟着移动.
解决方案 »
- 程序用嵌入Word的方式打开word文档的问题,关于设置“只读”
- ▲▲▲讨论:用netmeeting的做服务的问题!!▲▲▲
- 我要写一个组件怎样来注册这样的属性
- 请问,进销存的财务系统中的流水账号是什么意思?急急~~~~```
- 小弟要做一个曲线图或者直方图~~~不知道如何下手请各位高手帮忙 在线等~~
- 请看源码!我要新定义一个类型TDrawingTool,我是一个Delphi的新手,买了一本书书上是这么写的?帮我检查一下!
- bpg文件是做什么用的?com组件问题。
- 在Delphi6中如何做出象呼吸软件的标题栏?
- 用installshield制作安装程序问题?
- 如何将数组全部显示,如何格式化显示?
- 请问怎么学好delphi
- !!!算法挑战!!!
我瞎说的
不知道行不行。
PrePoint: TPoint;
Down: Boolean;procedure TForm1.Image1MouseDown(Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
begin
if (Button = MBLeft) then
begin
Down := true;
Screen.Cursor := crSizeAll;
GetCursorPos(PrePoint);
end;
end;procedure TForm1.Image1MouseMove(Shift: TShiftState; X, Y: Integer);
Var
NowPoint: TPoint;
begin
if Down then
begin
GetCursorPos(NowPoint);
Self.Parent.Left := Self.Parent.Left + NowPoint.X - PrePoint.X;
Self.Parent.Top := Self.Parent.Top + NowPoint.Y - PrePoint.Y;
PrePoint := NowPoint;
end;
end;procedure TForm1.Image1MouseUp(Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
begin
if (Button = MBLeft) and Down then
begin
Down := False;
Screen.Cursor := crDefault;
end;
end;