C#System.Drawing Graphic未实现的异常

时间:2011-07-26 18:39:05

标签: graphics c#-4.0 notimplementedexception

以下代码编译,但是当调用该方法时,我得到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

1 个答案:

答案 0 :(得分:4)

According to the documentation你只能通过构成平行四边形的三个点。

如果您想要三角形,则需要clip the drawing