Winform下richtextbox截图实现

 1  #region 根据richtextbox创建GDI+
 2         private void DrawGDI(RichTextBox rich,Panel panl,PictureBox p2)
 3         {
 4             rich.Update();
 5             Bitmap bmp = new Bitmap(rich.Width, rich.Height);
 6             using (Graphics gr = Graphics.FromImage(bmp))
 7             {
 8                 gr.CopyFromScreen(rich.PointToScreen(Point.Empty), Point.Empty, rich.Size);
 9             }
10             p2.Image = bmp;
11             panl.Controls.Remove(rich);
12             panl.Controls.Add(p2);
13             panl.Update();          
14         }
15         #endregion

 

posted @ 2015-06-30 16:12  赵碧金  阅读(505)  评论(0编辑  收藏  举报