rt,就是用.net 把一个文字保存成一个图片
解决方案 »
- 系统使用说明怎么写?求助!!
- 上传文件后文件夹属性为什么会自动变为只读的???
- winform 不规则显示
- Membership.ValidateUser的问题
- 请教C#属性问题!如何判断属性赋值失败??急!
- 在winfowm上运行的remoting程序(客户端、服务器端)可以运行,但利用webform客户端调用服务器端就出错,大家帮助。
- 菜鸟问题,求教
- 请教一下各位大侠(关于windows 应用程序方面)
- 各位兄弟姐妹,我两天都捆在这里了,帮帮我.我用Net自带的Mail控件添加附件的时候怎么在客户机上面报错误?
- 请问C#里怎么执行无窗体的程序呢????
- 拜托大侠关于一个2的次方公式问题。。简单。 小弟数学差。啊55555在线等
- 数据窗口问题
int _FontSize = 6;
string _ShowName = "要生成图片的文字";
Bitmap objBitmap = null;
Graphics g = null ;
Font stringFont = new Font(_FontName, _FontSize, FontStyle.Bold );
StringFormat stringFormat = new StringFormat();
stringFormat.FormatFlags = StringFormatFlags.NoWrap;
try
{
objBitmap = new Bitmap(1,1);
g = Graphics.FromImage(objBitmap);
SizeF stringSize = g.MeasureString(_ShowName, stringFont);
int nWidth = (int)stringSize.Width;
int nHeight = (int)stringSize.Height;
g.Dispose();
objBitmap.Dispose(); objBitmap = new Bitmap(nWidth,nHeight);
g = Graphics.FromImage(objBitmap);
g.FillRectangle(new SolidBrush(Color.Yellow), new Rectangle(0,0,nWidth,nHeight));
g.TextRenderingHint = TextRenderingHint.AntiAlias;
g.DrawString(_ShowName, stringFont, new SolidBrush(Color.Black), new PointF(0, 0), stringFormat);
objBitmap.Save(Response.OutputStream, ImageFormat.Gif);
}
catch (Exception ee)
{
Response.Write(ee.ToString());
}
finally
{
if (null != g) g.Dispose();
if (null != objBitmap) objBitmap.Dispose();
Response.End();
}