【发布时间】:2010-02-15 13:03:41
【问题描述】:
我有一个在 XP 和 Vista 上运行良好的 .NET 2.0 应用程序,但在 Windows 7 RC (x64) 上它崩溃并出现以下错误:
异常信息
异常类型:System.OutOfMemoryException 消息:内存不足。 数据:System.Collections.ListDictionaryInternal TargetSite: Void .ctor(System.Drawing.Image, System.Drawing.Drawing2D.WrapMode) 帮助链接:NULL 来源:System.Drawing
堆栈跟踪信息
在 System.Drawing.TextureBrush..ctor(Image image, WrapMode wrapMode) 在 System.Windows.Forms.ControlPaint.DrawBackgroundImage(图形 g,图像背景图像,颜色背景色,图像布局背景图像布局,矩形边界,矩形 clipRect,点滚动偏移,RightToLeft rightToLeft) 在 System.Windows.Forms.Control.PaintBackground(PaintEventArgs e,矩形矩形,颜色背景色,点滚动偏移) 在 System.Windows.Forms.Control.PaintBackground(PaintEventArgs e,矩形矩形) 在 System.Windows.Forms.Control.OnPaintBackground(PaintEventArgs pevent) 在 System.Windows.Forms.ScrollableControl.OnPaintBackground(PaintEventArgs e) 在 System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e,Int16 层,布尔 disposeEventArgs) 在 System.Windows.Forms.Control.WmPaint(消息和 m) 在 System.Windows.Forms.Control.WndProc(消息和 m) 在 System.Windows.Forms.ScrollableControl.WndProc(Message&m)
关于为什么会发生这种情况的任何想法,或者我可以如何围绕它进行编程?它只是绘制一个没有特殊背景的标准winform。
更新: 我发现这只是当 BackgroundImageLayout = ImageLayout.Tile 时的问题,这也是默认设置。将其设置为缩放或居中,问题就会消失。不过这很不令人满意,因为我需要它来平铺。
【问题讨论】:
-
在 XP 和 Vista 64 位上可以正常工作吗?
-
是的,它适用于 32 位和 64 位版本的 XP 和 Vista。
-
谢谢(这是在黑暗中拍摄,最近遇到了与跨拱问题相关的类似问题。)抱歉,没有想法。