預設線條箭頭過小或過大,影響視覺效果。
AdjustableArrowCap
using System.Drawing.Drawing2D;
AdjustableArrowCap cap = new AdjustableArrowCap(6, 6, true); // 寬度、高度、是否填充
Pen pen = new Pen(Color.Red, 2);
pen.CustomEndCap = cap;
// 繪圖
graphics.DrawLine(pen, startPoint, endPoint);
width、height:箭頭尺寸 (單位同繪圖單位,預設像素)。isFilled:true 實心三角箭頭,false 空心。CustomStartCap 修改起點樣式。簡單兩行代碼即可精確控制箭頭外觀,適用於流程圖、向量圖繪製等場景。