Silverlight 引路蜂二维图形库示例:线段末端形状(LineCap)

jerry Silverligth 2015年11月26日 收藏

LineCap 指定了开放路径端点的形状。有三种不同的类型:CAP_BUTT, CAP_ROUND和CAP_SQUARE。

下面代码显示了三种不同的LineCap类型。

private void LineCap()
{
 Color blackColor = new Color(0x000000);
 Color whiteColor = new Color(0xffffff);
 graphics2D.Reset();
 graphics2D.Clear(Color.White);

 Pen pen = new Pen(blackColor, 20, Pen.CapButt, Pen.JoinMiter);
 graphics2D.DrawLine(pen, 40, 60, 140, 60);
 pen = new Pen(whiteColor, 1);
 graphics2D.DrawLine(pen, 40, 60, 140, 60);
 pen = new Pen(blackColor, 20, Pen.CapRound, Pen.JoinMiter);
 graphics2D.DrawLine(pen, 40, 100, 140, 100);
 pen = new Pen(whiteColor, 1);
 graphics2D.DrawLine(pen, 40, 100, 140, 100);

 pen = new Pen(blackColor, 20, Pen.CapSquare, Pen.JoinMiter);
 graphics2D.DrawLine(pen, 40, 140, 140, 140);
 pen = new Pen(whiteColor, 1);
 graphics2D.DrawLine(pen, 40, 140, 140, 140);
}