c# GDI+中发生一般性错误的解决办法

 

1,保存路径文件夹目录不存在(保存前先判断目录是否存在,不存在创建)

            
            string path =  System.IO.Directory.GetCurrentDirectory() + "\\img\\";
           
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            

 

2,图片在使用中,没有被释放掉

bitmap.Dispose();

 

posted @ 2022-03-18 17:08  qingjiawen  阅读(883)  评论(0编辑  收藏  举报