public static MemoryStream BitmapStreamResize(MemoryStream IntputStream, double Scale) { if (IntputStream != null && Scale > 0) { try { Bitmap OriginImg = new Bitmap(IntputStream); return(BitmapStreamResize(OriginImg, Scale)); } catch { CDebug.jmsgEx("BitmapStreamResize Stream Error"); return(null); } } else { CDebug.jmsgEx("BitmapStreamResize Parameter Error"); return(null); } }
public static void jlog(string log_string, params Object[] args) { if (_flog == null) { initFileLogger(); } updateFileNamebyDate(); if (!File.Exists(m_strFullFilePath)) ///更換日期 { string logPathname = System.Windows.Forms.Application.StartupPath; //執行程式的路徑;//Directory.GetCurrentDirectory(); if (m_FileLogName == null) { m_strFullFilePath = string.Format("{0}\\[{1:0000}_{2:00}_{3:00}]{4}.log", logPathname, DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, m_strLogFileName); } else { m_strFullFilePath = string.Format("{0}\\[{1:0000}_{2:00}_{3:00}]{4}_{5}.log", logPathname, DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, m_strLogFileName, m_FileLogName); } _flog = File.CreateText(m_strFullFilePath); } string strMsg2Log; if (args.Length <= 0) { strMsg2Log = log_string; } else { strMsg2Log = string.Format(log_string, args); } _flog.WriteLine("[" + DateTime.Now.ToString("HH:mm:ss") + "]> " + strMsg2Log); _flog.Flush(); if (T_DEBUG == true) { CDebug.jmsg("{0}", strMsg2Log); } }
public static MemoryStream BitmapStreamResize(Bitmap IntputBitmap, double Scale) { if (IntputBitmap != null && Scale > 0 && IntputBitmap.Width > 0 && IntputBitmap.Height > 0) { try { Bitmap ResizeImg = ResizeProcess(IntputBitmap, IntputBitmap.Width, IntputBitmap.Height, (int)(IntputBitmap.Width * Scale), (int)(IntputBitmap.Height * Scale)); MemoryStream ResizeStream = new MemoryStream(); ResizeImg.Save(ResizeStream, System.Drawing.Imaging.ImageFormat.Png); return(ResizeStream); } catch { CDebug.jmsgEx("BitmapStreamResize Transfer Error"); return(null); } } else { CDebug.jmsgEx("BitmapStreamResize Parameter Error"); return(null); } }