(Max Christian)
11/24/2004 6:07:00 PM
I got an exception in CreateCompatibleDIB in a stable, deployed
application today -- the stack trace is at the bottom of this message.
The thing is, the trace shows that none of my code was running so I'm at
a loss as to what to do about it.
In case it's relevant, I'm overriding a PictureBox and drawing onto its
Image in the OnPaint override. I'm also doing this:
Private Sub PlanControl_Resize(ByVal sender As Object, ByVal e As
System.EventArgs) _
Handles MyBase.Resize
Image = New Bitmap(CInt(Width), CInt(Height))
MyBase.Invalidate()
End Sub
Here's the exception:
The parameter is incorrect
at
System.Windows.Forms.DibGraphicsBufferManager.CreateCompatibleDIB(IntPtr
hdc, IntPtr hpal, Int32 ulWidth, Int32 ulHeight, IntPtr& ppvBits)
at System.Windows.Forms.DibGraphicsBufferManager.CreateBuffer(IntPtr
src, Int32 offsetX, Int32 offsetY, Int32 width, Int32 height)
at
System.Windows.Forms.DibGraphicsBufferManager.AllocBuffer(Graphics
targetGraphics, IntPtr targetDC, Rectangle targetBounds)
at
System.Windows.Forms.DibGraphicsBufferManager.AllocBufferInTempManager(Graphics
targetGraphics, IntPtr targetDC, Rectangle targetBounds)
at System.Windows.Forms.DibGraphicsBufferManager.AllocBuffer(IntPtr
target, Rectangle targetBounds)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
If anyone can suggest was might be causing this it would be enormously
helpful. (It was probably running on Windows 98, if that makes any
difference.)
Max Christian