c# - How to move a rectangle in a Canvas? -
if want move rectangle in canvas, have modify top , left properties? thats way see possible. making tile-based game, , rectangles want move filled images of enemies , hero.
you can use rendertransform on rectangle.
<window x:class="wpfapplication2.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525"> <canvas> <rectangle width="10" height="10" fill="red"> <rectangle.rendertransform> <translatetransform x="10" y="10"/> </rectangle.rendertransform> </rectangle> </canvas> </window>
Comments
Post a Comment