双缓存处理图片等
private void Form1_Paint(object sender, PaintEventArgs e) { BufferedGraphics bg; Graphics g; BufferedGraphicsContext bc = BufferedGraphicsManager.Current; bg = bc.Allocate(this.CreateGraphics(), this.DisplayRectangle);//Graphics存入缓存区 g = bg.Graphics;//得到缓存区的Graphics Pen p = new Pen(Color.Red); p.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot; p.Width = 2; g.DrawLine(p, 10, 10, 200, 10); bg.Render();//复制出缓存区并呈现出来 bg.Dispose(); p.Dispose();
浙公网安备 33010602011771号