private void Draw() { //创建在pictureBox1上的图像g1 Graphics g1 = stage.CreateGraphics(); // 将图像画在内存上,并使g为pictureBox1上的图像 BufferedGraphicsContext currentContext = BufferedGraphicsManager.Current; BufferedGraphics myBuffer = currentContext.Allocate(g1, this.DisplayRectangle); Graphics g = myBuffer.Graphics; // 自定义绘图 Map.draw(map, player, npc, g, new Rectangle(0, 0, stage.Width, stage.Height)); if (Panel.panel != null) { Panel.draw(g); } draw_mouse(g); // 显示图像并释放资源 myBuffer.Render(); myBuffer.Dispose(); }