W
wgzhang
Unregistered / Unconfirmed
GUEST, unregistred user!
新建Form1,Form2,在Form1上,放两个Label,都有以下事件DblClick,MouseDown,DragDrop和DragOver.
一切运行正常.
如果在DblClick时,把 Form2.Show;改成 Form2.ShowModal;
关闭Form2后,注意鼠标的模样!
procedure TForm1.Label1DblClick(Sender: TObject);
begin
(Sender as TLabel).Caption:='DblClick';
Form2.Show;
end;
procedure TForm1.Label1MouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
begin
(Sender as TLabel).begin
Drag(False,10);
end;
procedure TForm1.Label1DragDrop(Sender, Source: TObject;
X, Y: Integer);
begin
(Sender as TLabel).Caption:=(Source as TLabel).Caption;
end;
procedure TForm1.Label1DragOver(Sender, Source: TObject;
X, Y: Integer;
State: TDragState;
var Accept: Boolean);
begin
Accept:=(Sender is TLabel);
end;
一切运行正常.
如果在DblClick时,把 Form2.Show;改成 Form2.ShowModal;
关闭Form2后,注意鼠标的模样!
procedure TForm1.Label1DblClick(Sender: TObject);
begin
(Sender as TLabel).Caption:='DblClick';
Form2.Show;
end;
procedure TForm1.Label1MouseDown(Sender: TObject;
Button: TMouseButton;
Shift: TShiftState;
X, Y: Integer);
begin
(Sender as TLabel).begin
Drag(False,10);
end;
procedure TForm1.Label1DragDrop(Sender, Source: TObject;
X, Y: Integer);
begin
(Sender as TLabel).Caption:=(Source as TLabel).Caption;
end;
procedure TForm1.Label1DragOver(Sender, Source: TObject;
X, Y: Integer;
State: TDragState;
var Accept: Boolean);
begin
Accept:=(Sender is TLabel);
end;