LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I move a drawn oject on a Canvas?

I draw a Rect on a Canvas! Is it possible to move that Rect on the Canvas?
0 Kudos
Message 1 of 2
(3,037 Views)
If all you have in the canvas is the rect, then you can use the CanvasScroll function. But this function moves an entire block of the canvas, so if you have other shapes intersecting your rect you might not want to do this.

An alternative is to use an xor pen to draw the rect (ATTR_PEN_MODE = VAL_XOR_MODE). If you do this, then when you draw the rect again in the same exact position it will have the effect of erasing the rect, while preserving the original background. Then you could just redraw the rect in the new position.
One caveat with this approach is that you will have to pick a color that, when xor'ed with the canvas background color, will result in the color that you really want for the rect.

Luis
NI
0 Kudos
Message 2 of 2
(3,037 Views)