문제

I want to create a program that saves a bmp file to my pictures\test. Because of some unknown reason I get -" A generic error occurred in GDI+." Please help me understand why this is happening to me. My code is:

System.Drawing.Image img = Properties.Resources.pic;
        string path = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
        string path2 = path+@"\"+"test";
        img.Save(path2, System.Drawing.Imaging.ImageFormat.Bmp);

올바른 솔루션이 없습니다

다른 팁

Could be any number of things, but try saving a copy of the image:

System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(Properties.Resources.pic);
string path = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
string path2 = path+@"\"+"test";
bmp.Save(path2);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top