C# System.Drawing Graphic 未实现异常

发布于 2024-11-26 08:09:08 字数 1495 浏览 0 评论 0原文

下面的代码可以编译,但是当调用该方法时,我得到 System.NotImplementedException: Not Implemented. 我没有使用自定义类。

private void miterTopLeft(Image img, Graphics gfx)
{
    int maxSize = Math.Max(img.Height, img.Width);
    Point[] points = new Point[4];
    points[0] = new Point(0, 0);
    points[1] = new Point(maxSize, maxSize);
    points[2] = new Point(0, maxSize);
    points[3] = new Point(0, 0);
    gfx.DrawImage(img, points);
}

为什么 .NET 类中会出现此错误?有解决办法吗?

堆栈跟踪:

[NotImplementedException: Not implemented.]
System.Drawing.Graphics.CheckErrorStatus(Int32 status) +1154064
System.Drawing.Graphics.DrawImage(Image image, PointF[] destPoints) +150
GetMergeImage.miterTopLeft(Image img, Graphics gfx) in d:\.NET Projects\publish2\GetMergeImage.ashx:51
GetMergeImage.drawLeftBorderRectangeRug(Double ppi, Boolean hasCorner, Graphics gfx, DesignVO border, Image img, Double vBorderStartY, Double vBorderStartX, Double vBorderNumRepeat) in d:\.NET Projects\publish2\GetMergeImage.ashx:243
GetMergeImage.drawRectangularRug(Int32 displayWidth, Int32 displayHeight, Int32 width, Int32 height, MergeVO merge) in d:\.NET Projects\publish2\GetMergeImage.ashx:140
GetMergeImage.ProcessRequest(HttpContext context) in d:\.NET Projects\publish2\GetMergeImage.ashx:40
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

The following code compiles, but when the method is called I get System.NotImplementedException: Not implemented. I'm not using custom classes.

private void miterTopLeft(Image img, Graphics gfx)
{
    int maxSize = Math.Max(img.Height, img.Width);
    Point[] points = new Point[4];
    points[0] = new Point(0, 0);
    points[1] = new Point(maxSize, maxSize);
    points[2] = new Point(0, maxSize);
    points[3] = new Point(0, 0);
    gfx.DrawImage(img, points);
}

Why is this error occuring in a .NET class? Is there a work around?

Stack Trace:

[NotImplementedException: Not implemented.]
System.Drawing.Graphics.CheckErrorStatus(Int32 status) +1154064
System.Drawing.Graphics.DrawImage(Image image, PointF[] destPoints) +150
GetMergeImage.miterTopLeft(Image img, Graphics gfx) in d:\.NET Projects\publish2\GetMergeImage.ashx:51
GetMergeImage.drawLeftBorderRectangeRug(Double ppi, Boolean hasCorner, Graphics gfx, DesignVO border, Image img, Double vBorderStartY, Double vBorderStartX, Double vBorderNumRepeat) in d:\.NET Projects\publish2\GetMergeImage.ashx:243
GetMergeImage.drawRectangularRug(Int32 displayWidth, Int32 displayHeight, Int32 width, Int32 height, MergeVO merge) in d:\.NET Projects\publish2\GetMergeImage.ashx:140
GetMergeImage.ProcessRequest(HttpContext context) in d:\.NET Projects\publish2\GetMergeImage.ashx:40
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

戏剧牡丹亭 2024-12-03 08:09:08

根据文档,您只能通过构成平行四边形的三个点。

如果您想要一个三角形,则需要剪辑绘图< /a>

According to the documentation you can only pass three points that make up a parallelogram.

If you want a triangle you will need to clip the drawing

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文