您的位置:程序门 -> c/c++ ->



用c画图函数画图时的屏幕刷新的问题?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


用c画图函数画图时的屏幕刷新的问题?
发表于:2007-07-01 23:19:16 楼主
用c画图是不是不停的刷新屏幕很画图呀?
那这样屏幕会不停闪,我眼睛快花了~
求高手解救~
发表于:2007-07-01 23:52:531楼 得分:0
不会吧,你做什么图哦;我做的时候好象没出现过这样的情况
发表于:2007-07-02 02:14:322楼 得分:0
开个缓冲吧
后台页面处理数据,
前台只负责显示,
这样会好很多
发表于:2007-07-02 10:14:323楼 得分:0
“开个缓冲吧
后台页面处理数据,
前台只负责显示,
这样会好很多“复杂了点~能不能简单一点,最好能加个例子,谢谢
发表于:2007-07-02 14:20:424楼 得分:0
那这样屏幕会不停闪,我眼睛快花了~
-------------------------------------刷得快眼睛看不出来啊!
或者你先把图画到缓冲区,画完之后,直接从缓冲区显示出来。用bitblt这个函数,具体察看msdn
bitblt
the   bitblt   function   performs   a   bit-block   transfer   of   the   color   data   corresponding   to   a   rectangle   of   pixels   from   the   specified   source   device   context   into   a   destination   device   context.  

bool   bitblt(
    hdc   hdcdest,   //   handle   to   destination   device   context
    int   nxdest,     //   x-coordinate   of   destination   rectangle 's   upper-left  
                              //   corner
    int   nydest,     //   y-coordinate   of   destination   rectangle 's   upper-left  
                              //   corner
    int   nwidth,     //   width   of   destination   rectangle
    int   nheight,   //   height   of   destination   rectangle
    hdc   hdcsrc,     //   handle   to   source   device   context
    int   nxsrc,       //   x-coordinate   of   source   rectangle 's   upper-left  
                              //   corner
    int   nysrc,       //   y-coordinate   of   source   rectangle 's   upper-left  
                              //   corner
    dword   dwrop     //   raster   operation   code
);

发表于:2007-07-02 14:23:575楼 得分:0
//选择作图到缓冲区:
hdcmem     =   createcompatibledc(hdcwork);
hbitmap   =   createcompatiblebitmap(hdcmem,   w,   h);
holdbitmap   =   selectobject(hdcmem,   hbitmap);
//画图
drawback(x,y,w,h,0);
//显示
bitblt(hdcwork,   0,   0,   w,   h,   hdcmem,   0,   0,   srccopy);
发表于:2007-07-03 13:25:016楼 得分:0
会闪是你画画太快了吧。(刷新图片速度)。
你可以每画一个图片用sleep(1);来停下,这样就不闪拉
发表于:2007-07-03 13:35:147楼 得分:0
闪的原因

1)   清背景造成的,   可以用双缓冲解决

2)   你可能刷新过快



快速检索

最新资讯
热门点击