diff --git a/插件库/Lskj.Util/ImageHelper.cs b/插件库/Lskj.Util/ImageHelper.cs index f31a754..9412bcd 100644 --- a/插件库/Lskj.Util/ImageHelper.cs +++ b/插件库/Lskj.Util/ImageHelper.cs @@ -36,10 +36,9 @@ namespace Lskj.Util { if (bytes == null) return null; using (System.IO.MemoryStream ms = new System.IO.MemoryStream(bytes)) + using (System.Drawing.Image sourceImage = System.Drawing.Image.FromStream(ms)) { - System.Drawing.Image returnImage = System.Drawing.Image.FromStream(ms); - ms.Flush(); - return returnImage; + return new Bitmap(sourceImage); } } catch (Exception) @@ -56,14 +55,9 @@ namespace Lskj.Util { try { - FileStream fs = File.OpenRead(path); //OpenRead - int filelength = 0; - filelength = (int)fs.Length; //获得文件长度 - Byte[] image = new Byte[filelength]; //建立一个字节数组 - fs.Read(image, 0, filelength); //按字节流读取 - System.Drawing.Image result = System.Drawing.Image.FromStream(fs); - fs.Close(); - return result; + if (string.IsNullOrWhiteSpace(path) || !File.Exists(path)) return null; + byte[] image = File.ReadAllBytes(path); + return ReadImage(image); } catch (Exception) { diff --git a/插件库/Lskj.Util/PubUtil.cs b/插件库/Lskj.Util/PubUtil.cs index eca0daf..5c604d9 100644 --- a/插件库/Lskj.Util/PubUtil.cs +++ b/插件库/Lskj.Util/PubUtil.cs @@ -203,6 +203,21 @@ namespace Lskj.Util { get { return BitMapPath + "Main/Module/"; } } + /// + /// 主界面左侧树图标路径 + /// + public static string MainTreeviewImagePath + { + get + { + string path = BitMapPath + "Main\\MainTreeview\\"; + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + return path; + } + } public static string MesItemImage { get { return BitMapPath + "MesItem/"; }