Registriert seit: 6. Apr 2005
10.109 Beiträge
|
Re: TTabControl - Drag and Drop?
20. Feb 2007, 07:22
Guten Morgen,
hier noch die von mir angepasste Version zum Vergleichen:
Delphi-Quellcode:
procedure TDemoForm.TabControlDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
begin
with Sender as TTabControl do
Accept := (IndexOfTabAt(X, Y) <> TabIndex);
end;
procedure TDemoForm.TabControlDragDrop(Sender, Source: TObject; X,
Y: Integer);
var
index: Integer;
begin
if Sender = Source then
with Sender as TTAbControl do
begin
index := IndexOfTabAt(X, Y);
Tabs.Exchange(TabIndex, index);
TabIndex := index;
end;
end;
procedure TDemoForm.TabControlMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
p: TPoint;
begin
with Sender as TTabControl, p do
begin
p := ScreenToClient(Mouse.CursorPos);
if IndexOfTabAt(X, Y) > -1 then
BeginDrag(False);
end;
end;
Freundliche Grüße
|
|
Zitat
|