Windows 7 TextureBrush..ctor()错误 [英] Windows 7 TextureBrush..ctor() error

查看:520
本文介绍了Windows 7 TextureBrush..ctor()错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.NET 2.0应用程序运行只是在XP和Vista,但在Windows 7 RC(x64)它崩溃与以下错误:

I have a .NET 2.0 app that runs just fine on XP and Vista, but on Windows 7 RC (x64) it crashes with the following error:

异常信息

异常类型:System.OutOfMemoryException
消息:内存不足。
数据:System.Collections.ListDictionaryInternal
TargetSite:Void .ctor(System.Drawing.Image,System.Drawing.Drawing2D.WrapMode)
HelpLink:NULL
源:System。在System.Drawing.TextureBrush中绘制

Exception Type: System.OutOfMemoryException Message: Out of memory. Data: System.Collections.ListDictionaryInternal TargetSite: Void .ctor(System.Drawing.Image, System.Drawing.Drawing2D.WrapMode) HelpLink: NULL Source: System.Drawing

StackTrace信息

StackTrace Information

..ctor(Image image,WrapMode wrapMode)
在System.Windows.Forms.ControlPaint.DrawBackgroundImage(Graphics g,Image backgroundImage,Color backColor,ImageLayout backgroundImageLayout,Rectangle bounds,Rectangle clipRect,Point scrollOffset,RightToLeft rightToLeft)
at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e,Rectangle rectangle,Color backColor,Point 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 layer,Boolean disposeEventArgs)
在System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)

at System.Drawing.TextureBrush..ctor(Image image, WrapMode wrapMode) at System.Windows.Forms.ControlPaint.DrawBackgroundImage(Graphics g, Image backgroundImage, Color backColor, ImageLayout backgroundImageLayout, Rectangle bounds, Rectangle clipRect, Point scrollOffset, RightToLeft rightToLeft) at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle, Color backColor, Point scrollOffset) at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle) at System.Windows.Forms.Control.OnPaintBackground(PaintEventArgs pevent) at System.Windows.Forms.ScrollableControl.OnPaintBackground(PaintEventArgs e) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs) at System.Windows.Forms.Control.WmPaint(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m)

有关为什么会发生这种情况的任何想法,或者我如何编程?它只是画一个没有特殊背景的标准winform。

Any ideas about why this is happening, or how I might program around it? It's just painting a standard winform with no special background.

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

UPDATE: I've found that this is only an issue when the BackgroundImageLayout = ImageLayout.Tile, which is also the default. Set it to Zoom or Center, and the issue dissapears. That's pretty unsatisfactory though, because I need it to tile.

推荐答案

解决这个问题的解决方案与PNG文件本身用于背景。
我刚刚用Paint.NET打开它并重新保存,然后把它放回项目中并且工作。

Turns out the solution to this had to do with the PNG file itself used for the background. I just opened it with Paint.NET and resaved it, then put it back in the project and it worked.

不知道有什么改变,问题。

Not sure what changed, but it resolved the problem.

这篇关于Windows 7 TextureBrush..ctor()错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆