private void FormChooseWindow_Load(object sender, EventArgs e)
 {
     //设置本窗口全屏
     screenWidth                      = API.GetSystemMetrics(API.SM_CXSCREEN);
     screenHeight                     = API.GetSystemMetrics(API.SM_CYSCREEN);
     Location                         = Point.Empty;
     Size                             = new Size(screenWidth, screenHeight);
     stringFormatCenter               = new StringFormat();
     stringFormatCenter.Alignment     = StringAlignment.Center;
     stringFormatCenter.LineAlignment = StringAlignment.Center;
     bitmapBg                         = new Bitmap(screenWidth, screenHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
     bitmapDrawingBoard               = new Bitmap(screenWidth, screenHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
     //截下桌面的图,然后作为背景进行绘画
     using (Graphics g = Graphics.FromImage(bitmapBg))
         g.CopyFromScreen(Point.Empty, Point.Empty, new Size(screenWidth, screenHeight));
     timer1.Start();
     rectPen       = new Pen(Color.DodgerBlue, 5);
     brushBg       = new SolidBrush(Color.FromArgb(100, 0, 0, 0));
     formColorPick = new FormColorPick(this);
     formColorPick.Show();
     formColorPick.KeyDown  += FormScreenShutcut_KeyDown;
     formEditScreenShutTools = new FormEditScreenShutTools(this);
     formEditScreenShutTools.Show();
     Cursor   = formEditScreenShutTools.cur_default;
     paintBox = new PaintBox.PaintBox(this, formEditScreenShutTools);
     WindowUtils.Top(Handle);
     WindowUtils.Hide(formEditScreenShutTools.Handle);
     WindowUtils.Top(formColorPick.Handle);
 }
        private void FormChooseWindow_FormClosing(object sender, FormClosingEventArgs e)
        {
            //释放
            if (formColorPick != null)
            {
                formColorPick.Close();
                formColorPick = null;
            }
            if (formEditScreenShutTools != null)
            {
                formEditScreenShutTools.Close();
                formEditScreenShutTools = null;
            }
            if (stringFormatCenter != null)
            {
                stringFormatCenter.Dispose();
                stringFormatCenter = null;
            }
            if (brushBg != null)
            {
                brushBg.Dispose();
                brushBg = null;
            }
            if (rectPen != null)
            {
                rectPen.Dispose();
                rectPen = null;
            }
            if (bitmapBg != null)
            {
                bitmapBg.Dispose();
                bitmapBg = null;
            }
            if (bitmapDrawingBoard != null)
            {
                bitmapDrawingBoard.Dispose();
                bitmapDrawingBoard = null;
            }
            if (paintBox != null)
            {
                paintBox.Dispose();
                paintBox = null;
            }

            timer1.Stop();
        }