Listbox İtemlerinin Sırasını Mause ile sürükleyerek Değiştirmek
| ||||
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
procedure ListBox1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure ListBox1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormCreate(Sender: TObject);
procedure ListBox1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
ii: integer;
secili: boolean;
implementation
{$R *.dfm}
procedure TForm1.ListBox1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
i: integer ;
begin
i:= ListBox1.ItemAtPos(Point(x,y), True);
if (ii=i) then
Exit;
if secili then
if (i=(ii-1)) or (i=(ii+1)) then
begin
secili:= false;
ListBox1.Items.Move(ii, i);
ii:= i;
Secili:= true;
end;
end;
procedure TForm1.ListBox1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
secili:= false;
ListBox1.Cursor:= crDefault;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
secili:= false;
end;
procedure TForm1.ListBox1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Secili:= true;
ii:= ListBox1.ItemIndex;
end;
end.
Benzer Yazılar:
- ASCII Kodlarını Bulmak
- Ekran Klavyesi
- Delphi ile Mp3 dosya çalmak çaldırmak
- Bilgisayardaki Sürücü Listesini Almak
- Tüm Dosya ve Klasörlerin Listesini Almak
- Dosya Uzantısından Programın Tespiti
- Merkez Bankasindan Gunluk Doviz Kurlarini Alma Kodu
- Dataset ten XML e aktarım
- Metin İçerisinden Bir Karakter Silmek
- Çılgın Bir Gece Sinema Filmi HD Full İzle
Eğer yazıyı beğendiyseniz ya da ekleyecekleriniz varsa, lütfen yorumunuz yazın veya RSS aboneliği ile yeni yazılardan anında haberdar olun.




















