C# wpf 如何重绘 canvas 个组件
C# wpf how to repaint canvas components
我是 C# 编程的新手,我一直使用 Java。我正在尝试在 Visual Studio 上制作一个非常简单的跳线版本(例如 Doodle Jump),并且我创建了一个 WPF 项目。我需要知道在 canvas 上重新绘制对象的最好和最常见的方法(比如播放器和平台,它们都是矩形),以便对象不断更新(例如当我移动时播放器等)。提前致谢。
我建议你看看transformations. One of the wonderful things about WPF is that you usually don't have to worry about the animation clock or repainting the screen when things change. To move something around the screen, like a rectangle, all you have to do is attach a transformation to it, then update the properties of the transformation. WPF's background rendering thread will automatically take care of the screen update. That article should get you started. Also check out Storyboards做更精细的动画。
我是 C# 编程的新手,我一直使用 Java。我正在尝试在 Visual Studio 上制作一个非常简单的跳线版本(例如 Doodle Jump),并且我创建了一个 WPF 项目。我需要知道在 canvas 上重新绘制对象的最好和最常见的方法(比如播放器和平台,它们都是矩形),以便对象不断更新(例如当我移动时播放器等)。提前致谢。
我建议你看看transformations. One of the wonderful things about WPF is that you usually don't have to worry about the animation clock or repainting the screen when things change. To move something around the screen, like a rectangle, all you have to do is attach a transformation to it, then update the properties of the transformation. WPF's background rendering thread will automatically take care of the screen update. That article should get you started. Also check out Storyboards做更精细的动画。