C# WPF:如何绘制UML接口关系箭头?
我要绘制以下箭头类型: 我该怎么做 我已经有一个类似的箭头:C# WPF:如何绘制UML接口关系箭头?,c#,.net,wpf,C#,.net,Wpf,我要绘制以下箭头类型: 我该怎么做 我已经有一个类似的箭头: private void InternalDrawArrowGeometry(StreamGeometryContext context) { double theta = Math.Atan2(Y1 - Y2, X1 - X2); double sint = Math.Sin(theta); double cost = Math.Cos(the
private void InternalDrawArrowGeometry(StreamGeometryContext context)
{
double theta = Math.Atan2(Y1 - Y2, X1 - X2);
double sint = Math.Sin(theta);
double cost = Math.Cos(theta);
Point pt1 = new Point(X1, this.Y1);
Point pt2 = new Point(X2, this.Y2);
Point pt3 = new Point(
X2 + (HeadWidth * cost - HeadHeight * sint),
Y2 + (HeadWidth * sint + HeadHeight * cost));
Point pt4 = new Point(
X2 + (HeadWidth * cost + HeadHeight * sint),
Y2 - (HeadHeight * cost - HeadWidth * sint));
context.BeginFigure(pt1, true, false);
context.LineTo(pt2, true, true);
context.LineTo(pt3, true, true);
context.LineTo(pt4, true, true);
context.LineTo(pt2, true, true);
}
如何更改以使其不是箭头而是圆?在垂直堆叠面板中使用椭圆形状和垂直线(水平对齐设置为中心)。即:
<StackPanel>
<Ellipse HorizontalAlignment="Center" Height="10" Width="10"
Stroke="Black" />
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="0" Y2="10"
Stroke="Black" />
<Rectangle Width="40" Height="20" Stroke="Black"/>
</StackPanel>
我还在其中抛出了一个矩形来表示实现接口的类。在垂直堆栈面板中使用椭圆形状和垂直线(水平对齐设置为中心)。即:
<StackPanel>
<Ellipse HorizontalAlignment="Center" Height="10" Width="10"
Stroke="Black" />
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="0" Y2="10"
Stroke="Black" />
<Rectangle Width="40" Height="20" Stroke="Black"/>
</StackPanel>
我还在其中抛出了一个矩形来表示实现接口的类。谢谢,这应该可以,但是没有扩展Shape类的可能性吗?谢谢,这应该可以,但是没有扩展Shape类的可能性吗?