C#手工双缓冲技术用法实例分析
程序员文章站
2023-11-24 19:14:46
本文实例讲述了c#手工双缓冲技术。分享给大家供大家参考。具体如下:
using system;
using system.collections.generic...
本文实例讲述了c#手工双缓冲技术。分享给大家供大家参考。具体如下:
using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.text; using system.windows.forms; namespace advanced_drawing { public partial class form19 : form { bufferedgraphicscontext buffercontext; bitmap gif = new bitmap(@"d:/我的文档/桌面/ico/a.gif"); public form19() { initializecomponent(); buffercontext = new bufferedgraphicscontext(); buffercontext.maximumbuffer = this.clientrectangle.size; } void gif_framechanged(object sender, eventargs e) { graphics g = this.creategraphics(); bufferedgraphics frame = buffercontext.allocate(g, this.clientrectangle); imageanimator.updateframes(gif); frame.graphics.drawimage(gif, this.clientrectangle); frame.render(); } private void form19_formclosing(object sender, formclosingeventargs e) { buffercontext.dispose(); } private void form19_paint(object sender, painteventargs e) { if (imageanimator.cananimate(gif)) { imageanimator.animate(gif, gif_framechanged); } } } }
希望本文所述对大家的c#程序设计有所帮助。
上一篇: C#将数字转换成字节数组的方法
下一篇: C#实现异步发送邮件的方法