/// /// 绘制条形码 /// private void captureScreen() { using (Graphics g = panel1.CreateGraphics()) { Size s = panel1.Size; mImage = new Bitmap(s.Width, s.Height, g); using (Graphics mg = Graphics.FromImage(mImage)) { IntPtr dc1 = g.GetHdc(); IntPtr dc2 = mg.GetHdc(); BitBlt(dc2, 0, 0, panel1.ClientRectangle.Width, panel1.ClientRectangle .Height, dc1, 0, 0, 13369376); g.ReleaseHdc(dc1); mg.ReleaseHdc(dc2); } } }