//public static void CaptureJpg(RECT rect) //{2 // return; // string tmp = SetPicPath(GTR_dnf.m_strPictureDir, GTR_dnf.OrdNo); // ImageTool.GetScreenCapture(rect).Save(tmp, ImageFormat.Jpeg); //} public static void CaptureBmp(Bitmap BigBmp, RECT rect, string strPicName) { try { if (BigBmp == null) { return; } int width = rect.right - rect.left; int height = rect.bottom - rect.top; Rectangle srcRect = new Rectangle(rect.left, rect.top, width, height); BitmapData bigBData = BigBmp.LockBits(srcRect, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb); Bitmap bmp = new Bitmap(width, height, bigBData.Stride, PixelFormat.Format24bppRgb, bigBData.Scan0); bmp.Save(strPicName); BigBmp.UnlockBits(bigBData); } catch (Exception e) { FileRW.WriteToFile(e.ToString()); FileRW.WriteToFile(strPicName); } return; //ImageTool.GetScreenCapture(rect).Save(strPicName, ImageFormat.Bmp); }
public static int StartProcess(string proName, string args) { Process p = new Process(); //声明一个程序信息类 ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo(proName, args.Trim()); string strWorkDir = proName.Substring(0, proName.LastIndexOf("\\") + 1); Info.WorkingDirectory = strWorkDir; try { p = Process.Start(Info); } catch (System.ComponentModel.Win32Exception e) { //CommonClass.ShowTip("程序路径出错"); FileRW.WriteError(string.Format("系统找不到指定的程序文件:{0}", e.ToString())); return(0); } return(p.Id); }