.net - NotImplementedException 来自 .NET 的 CustomLineCap 构造函数

标签 .net gdi+ system.drawing notimplementedexception

我想绘制一个自定义线帽 - 一个半径为 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/

相关文章:

c# - 与 Entity Framework 和 MVC 的多对多关系与排序

.net - 页面.Response.Write()

c# - 在通过网关发送的 SMS 消息中编码 £ 无法正常工作

c++ - 将 hDC 转换为 4bpp 位图

c# - 不同分辨率下 graphics.MeasureString 的奇怪行为

winforms - Windows 服务与交互式应用程序中的 GDI 句柄

c# - 在C#中处理大文本文件

c# - 在 C# 中拖放矩形

.net - 如何在 asp.net 中为 Microsoft Chart Control 生成的图像设置分辨率 (DPI)

c# - 在 .Net Standard 中加载图像