Windows 7 TextureBrush..ctor()错误

Jon*_*ees 5 crash .net-2.0 windows-7

我有一个.NET 2.0应用程序在XP和Vista上运行得很好,但在Windows 7 RC(x64)上崩溃时出现以下错误:

例外信息


异常类型:System.OutOfMemoryException消息:内存不足.数据:System.Collections.ListDictionaryInternal TargetSite:空隙.ctor(System.Drawing.Image对象,System.Drawing.Drawing2D.WrapMode)HELPLINK:NULL来源:System.Drawing中

StackTrace信息


在System.Drawing.TextureBrush..ctor(图像图像,WrapMode wrapMode)在System.Windows.Forms.ControlPaint.DrawBackgroundImage(图形克,图片和backgroundImage,颜色背景色,ImageLayout backgroundImageLayout,矩形范围,矩形clipRect,点scrollOffset,从右至左从右至左)在System.Windows.Forms.Control.PaintBackground(PaintEventArgs的E,矩形矩形,颜色背景色,点scrollOffset)在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( Message&m)在System.Windows.Forms.ScrollableControl.WndProc(Message&m)的System.Windows.Forms.Control.WndProc(Message&m)处

关于为什么会发生这种情况的任何想法,或者我如何围绕它进行编程?它只是绘制一个没有特殊背景的标准winform.

更新:我发现这只是BackgroundImageLayout = ImageLayout.Tile时的一个问题,它也是默认值.将其设置为缩放或中心,问题消失.但这非常不令人满意,因为我需要它来平铺.

Jon*_*ees 1

事实证明,这个问题的解决方案与用于背景的 PNG 文件本身有关。我只是用 Paint.NET 打开它并重新保存,然后将其放回项目中,它就工作了。

不确定发生了什么变化,但它解决了问题。