Привет
есть такой код
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.IO.Compression;
using System.Windows.Forms;
namespace TestImageTypeSize
{
class Program
{
static void Main()
{
ImageFormat[ ] formats = new[ ] { ImageFormat.Gif, ImageFormat.Jpeg, ImageFormat.Png };
int screenId = 0;
foreach (Screen screen in Screen.AllScreens)
{
Bitmap bmp = new Bitmap(screen.Bounds.Width, screen.Bounds.Height);
Graphics g = Graphics.FromImage(bmp);
g.CopyFromScreen(screen.Bounds.X, screen.Bounds.Y, 0, 0, new Size(screen.Bounds.Width, screen.Bounds.Height));
foreach (ImageFormat format in formats)
{
string filename = @"t:\screen_" + screenId + "." + format;
bmp.Save(filename, format);
FileStream fileStream = new FileStream(filename + ".zip", FileMode.Create, FileAccess.ReadWrite);
GZipStream gZipStream = new GZipStream(fileStream, CompressionMode.Compress);
bmp.Save(gZipStream, format);
gZipStream.Close();
}
screenId++;
}
}
}
}
который падает в строке
bmp.Save(gZipStream, format);
с ошибкой
A generic error occurred in GDI+
используется VS2008 Team Ed, .NET 3.5 Sp1 на Win XP SP3
в чем ошибка?
Спасибо
... << RSDN@Home 1.2.0 alpha 4 rev. 1111>>
12.12.08 20:10: Перенесено модератором из 'MFC' — Кодт