Drag and Drop из RichEdit

Материал из DRKB

Drag and Drop из RichEdit[править | править код]

var
  Form1: TForm1;
  RichCopy: string;
  Transfering: Boolean;

implementation

{$R *.DFM}

procedure TForm1.RichEdit1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Length(RichEdit1.SelText) > 0 then 
  begin
    RichCopy: = RichEdit1.SelText;
    Transfering := True;
  end;
end;

procedure TForm1.ListBox1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  if Transfering then
  begin
    Transfering := False;
    ListBox1.Items.Add(RichCopy);
  end;
end;


Source: http://delphiworld.narod.ru/
ID: 00702