Listbox İtemlerinin Sırasını Mause ile sürükleyerek Değiştirmek

Reklam Alanı

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:

  1. ASCII Kodlarını Bulmak
  2. Ekran Klavyesi
  3. Delphi ile Mp3 dosya çalmak çaldırmak
  4. Bilgisayardaki Sürücü Listesini Almak
  5. Tüm Dosya ve Klasörlerin Listesini Almak
  6. Dosya Uzantısından Programın Tespiti
  7. Merkez Bankasindan Gunluk Doviz Kurlarini Alma Kodu
  8. Dataset ten XML e aktarım
  9. Metin İçerisinden Bir Karakter Silmek
  10. Çılgın Bir Gece Sinema Filmi HD Full İzle
Etiketler:

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.

Yorum yapın

*

Gizlilik Politikası