Move a rectangle around a canvas

前端 未结 2 1940
清歌不尽
清歌不尽 2021-01-25 06:42

I have a canvas in the middle of my application with controls around it. I have a socket that recieves Points and saves them in a list.

I draw small 4x4 rectangles on th

2条回答
  •  温柔的废话
    2021-01-25 07:21

    Use Rendering event

    CompositionTarget.Rendering += UpdateRectangles;
    

    ...

     protected void UpdateRectangles(object sender, EventArgs e)
     {
        // here some stuff
        Canvas.SetLeft(rectangle, location);
    
     }
    

    Consider using CacheMode="BitmapCache" for them.

提交回复
热议问题