C# PictureBox控件畫圖

 PictureBox的正方向:

BitMap初始化:

      Bitmap bt = new Bitmap(Width,Height);
      Graphics gdi = Graphics.FromImage(bt);

用到的幾種基本函數:

//寫文字
            gdi.DrawString(title,new Font("宋體",11),Brushes.Black,new PointF(Width / 2.0f - 20, 0.02F * Height));

//畫單線:

            Pen pen = new Pen(Color.Gray);
            pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
            gdi.DrawLine(pen,org,new PointF((org.X + 0.88f * (float)Width), org.Y));

//畫多線 

             gdi.DrawLines(pen,samples.ToArray());

 

posted @ 2019-01-24 14:49  web前端日志  阅读(452)  评论(0编辑  收藏  举报