DevComponents DotNetBar2 bug解决方法

为了美好窗体的样式,项目的服务器端主窗体继承了DevComponents DotNetBar2的Office2007Form类,但在随后的运行过程中遇到了一个问题,就是在服务器端运行较长时间会,会弹出一个警告框,但却不影响服务器端的运行。警告框的具体信息如下:

************** Exception Text **************
System.ComponentModel.Win32Exception: 操作成功完成。
   at System.Drawing.BufferedGraphicsContext.CreateCompatibleDIB(IntPtr hdc, IntPtr hpal, Int32 ulWidth, Int32 ulHeight, IntPtr& ppvBits)
   at System.Drawing.BufferedGraphicsContext.CreateBuffer(IntPtr src, Int32 offsetX, Int32 offsetY, Int32 width, Int32 height)
   at System.Drawing.BufferedGraphicsContext.AllocBuffer(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle)
   at System.Drawing.BufferedGraphicsContext.Allocate(IntPtr targetDC, Rectangle targetRectangle)
   at 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.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at DevComponents.DotNetBar.Office2007RibbonForm.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.63 (QFE.060727-6300)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
WAT.PMS.CaiJiService
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/JiNanWATSoft/PMS_CollectionServer/WAT.PMS.CaiJiService.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
DevComponents.DotNetBar2
    Assembly Version: 7.5.0.2
    Win32 Version: 7.5.0.2
    CodeBase: file:///C:/Program%20Files/JiNanWATSoft/PMS_CollectionServer/DevComponents.DotNetBar2.DLL
----------------------------------------
WAT.PMS.JOB
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/JiNanWATSoft/PMS_CollectionServer/WAT.PMS.JOB.DLL
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Accessibility
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.ServiceProcess
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.ServiceProcess/2.0.0.0__b03f5f7f11d50a3a/System.ServiceProcess.dll
----------------------------------------
Quartz
    Assembly Version: 1.0.0.2
    Win32 Version: 1.0.0.2
    CodeBase: file:///C:/Program%20Files/JiNanWATSoft/PMS_CollectionServer/Quartz.DLL
----------------------------------------
WAT.PMS.Utility
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/JiNanWATSoft/PMS_CollectionServer/WAT.PMS.Utility.DLL
----------------------------------------
log4net
    Assembly Version: 1.2.9.0
    Win32 Version: 1.2.9.0
    CodeBase: file:///C:/Program%20Files/JiNanWATSoft/PMS_CollectionServer/log4net.DLL
----------------------------------------
Common.Logging
    Assembly Version: 1.2.0.0
    Win32 Version: 1.2.0.0
    CodeBase: file:///C:/Program%20Files/JiNanWATSoft/PMS_CollectionServer/Common.Logging.DLL
----------------------------------------
System.Web
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Web/2.0.0.0__b03f5f7f11d50a3a/System.Web.dll
----------------------------------------
hf71pwde
    Assembly Version: 1.0.0.2
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
DataCenter.IoDrive.DeviceIoMgr
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/JiNanWATSoft/PMS_CollectionServer/DataCenter.IoDrive.DeviceIoMgr.DLL
----------------------------------------
DataCenter.IoDrive.DeviceIo
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/JiNanWATSoft/PMS_CollectionServer/DataCenter.IoDrive.DeviceIo.DLL
----------------------------------------
DataCenter.Utilities
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/JiNanWATSoft/PMS_CollectionServer/DataCenter.Utilities.DLL
----------------------------------------
DataCenter.Common.Core
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/JiNanWATSoft/PMS_CollectionServer/DataCenter.Common.Core.DLL
----------------------------------------
DataCenter.IoDrive.Device
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/JiNanWATSoft/PMS_CollectionServer/DataCenter.IoDrive.Device.DLL
----------------------------------------
DataCenter.RTDBCore
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/JiNanWATSoft/PMS_CollectionServer/DataCenter.RTDBCore.DLL
----------------------------------------
DataCenter.IoDrive.OpcChannel
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/JiNanWATSoft/PMS_CollectionServer/Channels/DataCenter.IoDrive.OpcChannel.dll
----------------------------------------
DataCenter.OpcClient
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/JiNanWATSoft/PMS_CollectionServer/DataCenter.OpcClient.DLL
----------------------------------------
DataCenter.IoDrive.OpcFoundation.OpcDevice
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/JiNanWATSoft/PMS_CollectionServer/Devices/DataCenter.IoDrive.OpcFoundation.OpcDevice.dll
----------------------------------------
DataCenter.Common.HistoryRecord
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/JiNanWATSoft/PMS_CollectionServer/DataCenter.Common.HistoryRecord.DLL
----------------------------------------
System.Data
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
WAT.PMS.Communication.Commom
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/JiNanWATSoft/PMS_CollectionServer/WAT.PMS.Communication.Commom.DLL
----------------------------------------
System.Transactions
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

试着搜索答案,最后得知这是DevComponents DotNetBar2的一个bug,解决方法可以将form.DoubleBuffered属性设为False,禁用窗体的辅助缓存,详细的解决方法页面可以看http://code.google.com/p/kaixin001-helper/issues/detail?id=16

PS:个人感觉bing要比google好用呢,就像这次就是用bing找的解决方法,同样的关键字用google搜索一个结果也没有,用bing却有两个结果,其中一个就是正解。

原文地址:https://www.cnblogs.com/zhangronghua/p/1505361.html