快速C#绘图问题 [英] Quick C# Drawing question

查看:62
本文介绍了快速C#绘图问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以可以说我编写了一个程序在屏幕上绘制一堆矩形,然后有一个圆,可以使用箭头键在屏幕上移动.

有没有一种方法可以告诉C#仅在我移动圆时才重绘该圆,而不必完全重绘屏幕上的所有内容?当我只移动圆时,必须重新绘制屏幕上的每个矩形似乎有点浪费,(:<

So lets say I made a program to draw a bunch of rectangles on the screen, and then I have a circle which I can move around the screen with arrow keys.

Is there a way to tell C# to only redraw the circle when I move it instead of having to redraw absolutely everything on the screen? It just seems a bit wasteful to have to redraw every rectangle on the screen when I''m only moving the circle :(

推荐答案

将背景"矩形绘制为到位图.
然后,在每次更新圆时,将圆覆盖到该位图的副本上并对其进行blit(显示).
Have the "background" rectangles painted to a bitmap.
Then at each circle-update overlay the circle onto a copy of that bitmap and blit it(display it).


这篇关于快速C#绘图问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆