July 6th, 2010, 10:04 AM
Drawing rubber-band lines and shapes on mouse events in WPF
I would like to draw lines and shapes smoothly and dynamically on mouseDown, mouseMove and mouseUp events on a WPF window and would like the behavior to be like this: On mouseDown the drawing procedure starts (The first point is taken), on mouseMove the drawing continues and previous shapes are cleared (The temporary and undecided second point is taken), on mouseUp the last shape is drawn and the procedure is done (The second point is decided). I tried to make a simple code to do that but it didn't look so smooth, I also couldn't clear the shapes already drawn on each mouseMove event. I wonder what is the best way to accomplish this with best performance.
Any help will be appreciated.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!