Board index » delphi » Draw with the cursor

Draw with the cursor


2004-07-06 06:34:54 PM
delphi116
Hi everybody !
Someone knows how I can draw on my image just using my cursor (like with the
white board of windows) ?
Thanks in advance.
Julien
 
 

Re:Draw with the cursor

I usually use the following "code" (assuming DrawImg = TImage you want to
draw on, and you want to draw ONLY when left button is pressed down):
procedure (for event) DrawImg.OnMouseDown:
begin
MouseDown := True;
end;
procedure (for event) DrawImg.OnMouseUp:
begin
MouseDown := False;
end;
procedure (for event) DrawImg.OnMouseMove(X,Y: Integer):
begin
If MouseDown then
DrawImg. .... .Pixels[X,Y] := YourColor;
end;
(Locate "Pixels" property in TImage to get what has to be placed instead of
those ....)
"Julien Villeneuve" <XXXX@XXXXX.COM>píše v diskusním
příspěvku news:40ea7fb1$XXXX@XXXXX.COM...
Quote
Hi everybody !

Someone knows how I can draw on my image just using my cursor (like with
the
white board of windows) ?

Thanks in advance.

Julien


 

Re:Draw with the cursor

Uhm... I don't think using Pixels[] is OK...
Try this:
OnMouseDown:
MouseDown := True;
DrawImg.Canvas.MoveTo(X, Y);
OnMouseUp:
MouseDown := False;
OnMouseMove:
if MouseDown then
DrawImg.Canvas.LineTo(X, Y);
Marcus
"Pavel Vymazal" <XXXX@XXXXX.COM>escreveu na mensagem
| I usually use the following "code" (assuming DrawImg = TImage you want to
| draw on, and you want to draw ONLY when left button is pressed down):
|
| procedure (for event) DrawImg.OnMouseDown:
| begin
| MouseDown := True;
| end;
|
| procedure (for event) DrawImg.OnMouseUp:
| begin
| MouseDown := False;
| end;
|
| procedure (for event) DrawImg.OnMouseMove(X,Y: Integer):
| begin
| If MouseDown then
| DrawImg. .... .Pixels[X,Y] := YourColor;
| end;
|
| (Locate "Pixels" property in TImage to get what has to be placed instead
of
| those ....)
|
|
| "Julien Villeneuve" <XXXX@XXXXX.COM>píše v diskusním
| příspěvku news:40ea7fb1$XXXX@XXXXX.COM...
|>Hi everybody !
|>
|>Someone knows how I can draw on my image just using my cursor (like with
| the
|>white board of windows) ?
|>
|>Thanks in advance.
|>
|>Julien
|>
|>
|
|