Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Erase ellipse in onmousemove event?

Status
Not open for further replies.

pierrotsc

Programmer
Nov 25, 2007
358
US
Ok, this is a programming help...I am working on a paint program. I want to display the size of a brush via an drawn ellipse at the cursor. When i move the cursor, i want the ellipse to follow.

I am currently able to draw the ellipse but cannot find a way to erase the previous drawn ellipse when i move the cursor. I end up with a lot of ellipses all over the canvas.

here's my code:
// Draw Ellipse
brush.style := bsclear;
pen.mode := pmnot;
pen.width := 1;
ellipse(xmouse - temprx, ymouse - tempry, xmouse + temprx, ymouse + tempry);

// This code if added will erase the previously drawn ellipse. I need to find a way to store the previous coordinates before it is called
brush.style := bsclear;
pen.mode := pmnot;
pen.width := 1;
ellipse(xmouse - temprx, ymouse - tempry, xmouse + temprx, ymouse + tempry);

I cannot find a way to store the previous coordinates and erase the previous ellipse before a new one is drawn when i mouve my mouse.

If anybody has the answer to my alogorithm dilemna, i would appreciate it.
Thanks.
PO
 
Never mind...I found my problem...I was declaring my temporary variables at the wrong place and it did not keep the correct old position...

PO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top