我想绘制一个自定义线帽 - 一个半径为 r 的等边三角形。显然我不能:
Dim triangleSide As Single = CSng(3 * r / Math.Sqrt(3))
Dim triangleHeight As Single = CSng(3 * r / 2)
path = New GraphicsPath()
Dim points() As PointF = New PointF() { _
New PointF(-triangleSide / 2, 0), _
New PointF(triangleSide / 2, 0), _
New PointF(0, triangleHeight) }
path.AddLines(points)
' Not Implemented Exception, Was is Das? '
_HlpCap = New CustomLineCap(path, Nothing)
我有什么问题还是只是一个框架错误?
编辑:
在 Mark Cidade 发表评论后,我尝试使用
(Nothing, path)
它有帮助,但我需要填充三角形,而不仅仅是将其描边......
最佳答案
异常来自 GDI+ 库返回 NotImplemented
状态来自其 GdipCreateCustomLineCap()
功能。尝试传递笔划路径而不是 Nothing
:
Dim path2 As GraphicsPath = New GraphicsPath()
path2.AddLines(points);
_HlpCap = New CustomLineCap(path, path2)
关于.net - NotImplementedException 来自 .NET 的 CustomLineCap 构造函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3395208/