Skip Navigation Links
技术文档
·网站建设
·软件使用
·图形设计
·程序开发
·网络应用
·电脑技巧
 
公司介绍
·公司简介
·索仕SRCOS网络应用平台
·索仕网站管理系统
·影视广告制作
·联系我们
 
 

GDI+生成动画式的Gif图片示例代码

12/3/2009 8:54:08 AM

想用GDI+生成动画式的Gif图片示例代码:

GDI+生成动画式的Gif图片示例代码Bitmap bmp = new Bitmap(100, 100);
GDI+生成动画式的Gif图片示例代码
Graphics g = Graphics.FromImage(bmp);
GDI+生成动画式的Gif图片示例代码
Font f = new Font("arial", 11f);
GDI+生成动画式的Gif图片示例代码
Brush b = Brushes.Blue;
GDI+生成动画式的Gif图片示例代码
GDI+生成动画式的Gif图片示例代码string txt = "Rotate text animation!";
GDI+生成动画式的Gif图片示例代码
SizeF sz = g.MeasureString(txt, f);
GDI+生成动画式的Gif图片示例代码
g.Clear(Color.WhiteSmoke);
GDI+生成动画式的Gif图片示例代码
g.DrawString(txt, f, b, 50-sz.Width/2, 50-sz.Height/2);
GDI+生成动画式的Gif图片示例代码
g.Flush();
GDI+生成动画式的Gif图片示例代码//(The following code create a starting frame from bmp)
GDI+生成动画式的Gif图片示例代码
GifImage.GifAnimation gif = new GifImage.GifAnimation(bmp, 
GDI+生成动画式的Gif图片示例代码
    GifImage.GraphicControlExt.Default);
GDI+生成动画式的Gif图片示例代码//(Set this property otherwise the animation will not play circularly)
GDI+生成动画式的Gif图片示例代码
gif.Application = GifImage.ApplicationExt.Default;
GDI+生成动画式的Gif图片示例代码//(Use global color table only, set this option will greatly decrease the size of output file)
GDI+生成动画式的Gif图片示例代码
gif.UseGlobalColorTableOnly = true;
GDI+生成动画式的Gif图片示例代码
GDI+生成动画式的Gif图片示例代码for (int i = 1; i < 36; ++i)
GDI+生成动画式的Gif图片示例代码GDI+生成动画式的Gif图片示例代码{
GDI+生成动画式的Gif图片示例代码
    g.Clear(Color.WhiteSmoke);
GDI+生成动画式的Gif图片示例代码
    g.TranslateTransform(50,50);
GDI+生成动画式的Gif图片示例代码
    g.RotateTransform(10f * i);
GDI+生成动画式的Gif图片示例代码
    g.DrawString(txt, f, b, sz.Width/-2, sz.Height/-2);
GDI+生成动画式的Gif图片示例代码
    g.ResetTransform();
GDI+生成动画式的Gif图片示例代码
    g.DrawString("Hello", f, Brushes.Red, -50 + i * 4, 20);
GDI+生成动画式的Gif图片示例代码
    g.DrawString("Yeah", f, Brushes.Orange, 60, -20+i*4);
GDI+生成动画式的Gif图片示例代码
GDI+生成动画式的Gif图片示例代码
    g.Flush();
GDI+生成动画式的Gif图片示例代码//(Create a frame from bitmap)
GDI+生成动画式的Gif图片示例代码
    gif.AddFrame(bmp);
GDI+生成动画式的Gif图片示例代码
}

GDI+生成动画式的Gif图片示例代码
GDI+生成动画式的Gif图片示例代码
f.Dispose();
GDI+生成动画式的Gif图片示例代码
g.Dispose();
GDI+生成动画式的Gif图片示例代码
bmp.Dispose();
GDI+生成动画式的Gif图片示例代码
GDI+生成动画式的Gif图片示例代码
FileStream fs = new FileStream(@"E:\vmlinux\GifImage.gif", FileMode.Create);
GDI+生成动画式的Gif图片示例代码//(Write animation to GifImage.gif)
GDI+生成动画式的Gif图片示例代码
gif.Save(fs);
GDI+生成动画式的Gif图片示例代码
fs.Close;
本文附件:
GifImage_demo.rar
作者:与时俱进 来源:博客园
 
 
 
昆明索仕科技开发有限公司 版权所有 Copyright© 2002-2010 Kunming Source Technology Exploitive Co.,LTD. All Rights Reserved.
电话:0871-5627877 业务QQ:163871 联系我们
本站基于:索仕网站信息管理系统建设 版本 2.0.4325