public void SaveAndQuit()
        {
            string fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next().ToString("00");
            string savePath = DialogUtils.ShowSaveImageFileDialog(Handle, "保存截图", fileName);

            if (savePath != null)
            {
                Bitmap bitmapTarget = new Bitmap(lastFindedWndRect.Width, lastFindedWndRect.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
                Bitmap bitmapSave   = new Bitmap(screenWidth, screenHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
                if (bitmapBg != null)
                {
                    Graphics g = Graphics.FromImage(bitmapSave);
                    g.DrawImage(bitmapBg, 0, 0, Width, Height);
                    if (paintBox != null)
                    {
                        Graphics gB = Graphics.FromImage(bitmapDrawingBoard);
                        paintBox.OnPaint(new PaintEventArgs(gB, ClientRectangle));
                        gB.Dispose();
                    }
                    if (bitmapDrawingBoard != null)
                    {
                        g.DrawImage(bitmapDrawingBoard, 0, 0, Width, Height);
                    }
                    g.Dispose();
                    g = null;
                    g = Graphics.FromImage(bitmapTarget);
                    g.DrawImage(bitmapSave, new Rectangle(0, 0, lastFindedWndRect.Width, lastFindedWndRect.Height),
                                new Rectangle(lastFindedWndRect.Left, lastFindedWndRect.Top, lastFindedWndRect.Width, lastFindedWndRect.Height), GraphicsUnit.Pixel);
                    g.Dispose();
                    g = null;

                    string ext = savePath.Substring(savePath.LastIndexOf('.'));
                    try
                    {
                        if (ext == ".bmp")
                        {
                            bitmapTarget.Save(savePath, System.Drawing.Imaging.ImageFormat.Bmp);
                        }
                        else if (ext == ".png")
                        {
                            bitmapTarget.Save(savePath, System.Drawing.Imaging.ImageFormat.Png);
                        }
                        else if (ext == ".jpg" || ext == ".jpeg")
                        {
                            bitmapTarget.Save(savePath, System.Drawing.Imaging.ImageFormat.Jpeg);
                        }
                        else if (ext == ".gif")
                        {
                            bitmapTarget.Save(savePath, System.Drawing.Imaging.ImageFormat.Gif);
                        }
                    }
                    catch (Exception e)
                    {
                        Utils.Utils.WriteDebugString(e.ToString());
                        FormMsg m = new FormMsg("无法写入图片:" + savePath + "\n错误信息:" + e.ToString(), "保存图片失败", "确定", "", "ScreenRecoder - 程序错误", Properties.Resources.error_r_o);
                        m.TopMost = true;
                        m.ShowDialog(this);
                    }
                }

                bitmapSave.Dispose();
                bitmapSave = null;
                bitmapTarget.Dispose();
                bitmapTarget = null;


                Quit();
            }
        }