Przenoszenie komponentów

0

Widziałem w jakimś programie coś takiego że klikałm na memo czy richedice i jak cały czas trzymając lewy przycisk myszki i ruszałem nią po formie komponent TMemo ruszał razem z nią i latał po formie pod kursorem jak to zrobić albo dajie linka gdzie to może być na forum szukałem tego na forum 15 minut ale nic nie znalazłem jeśli jest to prosze tylko o odpowiedz a ja sam skasuje tego posta.

0

http://4programmers.net/Forum/viewtopic.php?id=38586#68875

[dopisane pół godziny później]
czemu jeszcze nie usuneliście tego mojego posta [???] nie qmam

0

to chyba bedzie tak:
<font color="green">memo1.Left:=mouse.CursorPos.X-form1.Left;
memo1.Top:=mouse.CursorPos.Y-form1.Top;</span>

i musisz to wkleić w
<font color="green">procedure TForm1.Memo1MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);</span>

i dalej nie wiem jak to zrobić ale musisz jeszcze sprawdzić czy został wciśnięty klawisz myszki bo w <font color="green">on click</span> nie działa

A jak Ci to nie pomogło to skasuj tego posta.

0

Witam...
Nie wiem czy o to dokładnie chodzi:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Memo1: TMemo;
procedure Memo1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Memo1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Memo1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
Bt: Boolean = False;
x2, y2: Integer;

implementation

{$R *.dfm}

procedure TForm1.Memo1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Bt := True;
x2 := x;
y2 := y;
end;

procedure TForm1.Memo1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Bt := False;
end;

procedure TForm1.Memo1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
If Bt = True Then
Begin
memo1.Left := memo1.left - (x2 - x);
memo1.Top := memo1.top - (y2 - y);
End;
end;

end.

1 użytkowników online, w tym zalogowanych: 0, gości: 1