C# System.Drawing Graphic 未实现异常
下面的代码可以编译,但是当调用该方法时,我得到 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据文档,您只能通过构成平行四边形的三个点。
如果您想要一个三角形,则需要剪辑绘图< /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