c# - "Parameter is not valid"从 System.Drawing.Graphics.GetHdc() 抛出——仅在某些机器上

标签 c# winforms

我遇到了这个错误“Parameter is not valid”,它是从

抛出的
System.Drawing.Graphics.GetHdc()

奇怪的是,它只在一台机器上抛出这个错误,而在其他机器上不会。

抱歉含糊不清,你有什么办法可以解决这个问题吗?

最佳答案

看看这是否适用于您? Parameter is not valid

You'll find that your problem is caused by a GDI leak. Open up TaskManager and if the Processes Tab does not have a GDI objects column then add it via the View menu. You should then see that the GDI Objects keep growing until eventually your app falls over. Once you add the DeleteDC() call you should see that the GDI Objects stays fairly constant.

关于c# - "Parameter is not valid"从 System.Drawing.Graphics.GetHdc() 抛出——仅在某些机器上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3818440/

相关文章:

c# - 在 Xamarin Forms 中的应用程序之间共享数据

c# - Solidworks 和 Excel C# 引用系列零件设计表

c# - 使用 BookSleeve 维护一个开放的 Redis 连接

C# 非矩形按钮

c# - Linq 查询中的意外结果

c# - sql更新查询不更新数据库

c# - 在 Visual Studio 2012 中打开 .resx 文件时,出现 "The operation could not be completed. Invalid pointer"错误

c# - 删除按钮边框窗体

c# - 直到按下 alt 键才显示模态通用对话框

c#:分部分保存 JPG