决定倾家荡产问的问题
access中的存储二进制图片,我可以把它读出来,但是只能每次读一张,决定把它读出来后另存为[id+.bmp/jpeg]格式,有哪为大侠帮帮忙!赐给源码,解决后我倾家荡产,不过我倾家荡产也没有多少!!!!!!!
[解决办法]
说得如此可怜。
[解决办法]
private void CreateCheckCodeImage(string chcekcode)
{
if (chcekcode == null || chcekcode.Trim() == string.Empty) return;
System.Drawing.Bitmap image = new System.Drawing.Bitmap((int)Math.Ceiling((chcekcode.Length * 12.5)), 22);
Graphics g = Graphics.FromImage(image);
try
{
Random random = new Random();
g.Clear(Color.White);
for (int i = 0; i < 100; i++)
{
int x1 = random.Next(image.Width);
int y1 = random.Next(image.Height);
image.SetPixel(x1, y1, Color.FromArgb(random.Next()));
}
Font font = new System.Drawing.Font( "Arial ", 13, (System.Drawing.FontStyle.Bold));
System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(new Rectangle(0, 0, image.Width, image.Height), Color.Blue, Color.DarkRed, 1.2f, true);
g.DrawString(chcekcode, font, brush, 4, 2);
g.DrawRectangle(new Pen(Color.Silver), 0, 0, image.Width - 1, image.Height - 1);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
image.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
Response.ClearContent();
Response.ContentType = "image/Gif ";
Response.BinaryWrite(ms.ToArray());
}
finally
{
g.Dispose();
image.Dispose();
}
}
拿这段代码去改一下就行了,