G
Guest
Hello,
The Graphics.DrawImage method throws "Out of Memory" Exception if the
Matrix.RotateAt(X, Point(100,100), MatrixOrder.Append) was used with a value
of X = 180 + n * 360 where n is an integer.
Code snippet:
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Matrix matrix = e.Graphics.Transform;
matrix.RotateAt(180, m_center, MatrixOrder.Append);
e.Graphics.Transform = matrix;
e.Graphics.DrawImage(m_image, m_rect); // Exception thrown here
matrix.RotateAt(-180, m_center, MatrixOrder.Append);
e.Graphics.Transform = matrix;
}
Stack trace of the Exception:
System.Drawing.Graphics.CheckErrorStatus(Int32 status)
System.Drawing.Graphics.DrawImage(Image image, Int32 x, Int32 y, Int32
width, Int32 height)
System.Drawing.Graphics.DrawImage(Image image, Rectangle rect)
UserDrawnControl.Test.OnPaint(PaintEventArgs e)
System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16
layer, Boolean disposeEventArgs)
System.Windows.Forms.Control.WmPaint(Message& m)
System.Windows.Forms.Control.WndProc(Message& m)
System.Windows.Forms.ScrollableControl.WndProc(Message& m)
System.Windows.Forms.ContainerControl.WndProc(Message& m)
System.Windows.Forms.UserControl.WndProc(Message& m)
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
System.Windows.Forms.Application.Run(Form mainForm)
TestUserDrawnControl.Program.Main()
System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
System.Threading.ThreadHelper.ThreadStart_Context(Object state)
System.Threading.ExecutionContext.Run(ExecutionContext executionContext,
ContextCallback callback, Object state)
System.Threading.ThreadHelper.ThreadStart()
Is that a Bug?
Any help is greatly appreciated.
Thanks Alex
The Graphics.DrawImage method throws "Out of Memory" Exception if the
Matrix.RotateAt(X, Point(100,100), MatrixOrder.Append) was used with a value
of X = 180 + n * 360 where n is an integer.
Code snippet:
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Matrix matrix = e.Graphics.Transform;
matrix.RotateAt(180, m_center, MatrixOrder.Append);
e.Graphics.Transform = matrix;
e.Graphics.DrawImage(m_image, m_rect); // Exception thrown here
matrix.RotateAt(-180, m_center, MatrixOrder.Append);
e.Graphics.Transform = matrix;
}
Stack trace of the Exception:
System.Drawing.Graphics.CheckErrorStatus(Int32 status)
System.Drawing.Graphics.DrawImage(Image image, Int32 x, Int32 y, Int32
width, Int32 height)
System.Drawing.Graphics.DrawImage(Image image, Rectangle rect)
UserDrawnControl.Test.OnPaint(PaintEventArgs e)
System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16
layer, Boolean disposeEventArgs)
System.Windows.Forms.Control.WmPaint(Message& m)
System.Windows.Forms.Control.WndProc(Message& m)
System.Windows.Forms.ScrollableControl.WndProc(Message& m)
System.Windows.Forms.ContainerControl.WndProc(Message& m)
System.Windows.Forms.UserControl.WndProc(Message& m)
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
System.Windows.Forms.Application.Run(Form mainForm)
TestUserDrawnControl.Program.Main()
System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
System.Threading.ThreadHelper.ThreadStart_Context(Object state)
System.Threading.ExecutionContext.Run(ExecutionContext executionContext,
ContextCallback callback, Object state)
System.Threading.ThreadHelper.ThreadStart()
Is that a Bug?
Any help is greatly appreciated.
Thanks Alex