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 相对来说效果不错
2. 画之前 把其他不需要重画的客户区锁定
画完后 解除锁定LockWindowUpdate(theHandle); // 锁定
LockWindowUpdate(0); // 接触锁定试试
比如image放在panel上,就这样: panel.doublebufferd := True;
感謝miky教會我使用的這個方法!
.....
就是先建一个bitmap。
我是新手,不知道对不对。
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 相对来说效果不错
慢点就慢点了
我的image1放在scrollbox上,所以我在form的oncreate里写ScrollBox1.DoubleBuffered := true;
即使不锁定,重画整个image都不闪烁。