我在程序中会在一秒钟内调用多次LineTo方法,界面上会有闪烁感,如何让TImage的Canvas在绘图时不产生闪烁感?

解决方案 »

  1.   

    1. doublebufferd := True;
    2. 画之前 把其他不需要重画的客户区锁定
       画完后 解除锁定LockWindowUpdate(theHandle); // 锁定
    LockWindowUpdate(0); // 接触锁定试试
      

  2.   

    开启屏幕双缓冲试试:OnCreate中写入self.DoubleBuffered:= true;
      

  3.   

    设置doublebufferd ,
     比如image放在panel上,就这样:  panel.doublebufferd := True;
      

  4.   

    最好是用TBitmap在內存中畫,然後使用BitBlt貼到Image上,這樣就不會閃了.
    感謝miky教會我使用的這個方法!
      

  5.   

    sailxia(小帆) :用TBitmap怎么在内存中画?给个例子吧
      

  6.   

    image1.picture.bitmap:=tbitmap.creat;
    .....
    就是先建一个bitmap。
    我是新手,不知道对不对。
      

  7.   

    sailxia(小帆) :用TBitmap怎么在内存中画?给个例子吧// 这也是一种常用的方法 先在内存中创建一个BITMAP 但是不显示 他只用来重画 即满足你的LineTo 然后用 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
    );这个函数进行COPY.. 这样是从内存到内存的COPY 相对来说效果不错
      

  8.   

    self.DoubleBuffered:= true;
    慢点就慢点了
      

  9.   

    支持 doublebuffered := true;
    我的image1放在scrollbox上,所以我在form的oncreate里写ScrollBox1.DoubleBuffered := true;
    即使不锁定,重画整个image都不闪烁。