public void BitmapDrawLine(Bitmap bM, Point sPoint, Point ePoint, Color lineColor,float lineThickness) { Graphics g = Graphics.FromImage(bM); Pen myPen = new Pen(lineColor, lineThickness); myPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid; // 設定線條的端點及連接樣式 myPen.SetLineCap(System.Drawing.Drawing2D.LineCap.Round, System.Drawing.Drawing2D.LineCap.Round, System.Drawing.Drawing2D.DashCap.Round); g.DrawLine(myPen, sPoint, ePoint); }