when i am using function in onpaint.. i got the error
publico
{
if (IsSelected)
{ objSolidBrush =new SolidBrush(Color.Yellow); new Pen(Color.Yellow, m_PenWidth);
m_Pen =
}
else
{
objSolidBrush =
m_Pen =
}
g.FillPath(objSolidBrush, m_GenericTextPath);
g.DrawPath(m_Pen, m_GenericTextPath);//Error:Attempt to read or write protected the memory.This is often an indication that other memory is corrupt. }
- Edited bysmsurendar Monday, May 25, 2009 12:31 PM
- Changed TypeAland LiMSFT, ModeratorMonday, June 01, 2009 12:55 PMOP not reply
- Changed TypeAland LiMSFT, ModeratorWednesday, June 03, 2009 7:50 AMReply
- Edited bysmsurendar Monday, May 25, 2009 12:31 PM
-
| | smsurendar Monday, May 25, 2009 12:28 PM | Thank you.. I got the answer.We need to update windows. Surendar- Marked As Answer byAland LiMSFT, ModeratorWednesday, June 03, 2009 7:50 AM
-
| | smsurendar Wednesday, June 03, 2009 6:07 AM | Hi smsurendar,
I made a project and wrote similar code as you descript, but I didn't find any error while running it. Could you give me more detail information about your problem or the complete code snippet?
In your code, you didn't release the pen and brush, I suggest to you that you can use 'using' key word to operate on pen and brush or call Dispose method after you use them.
Let me know if this helps.
Best Regards, Aland Li
Please mark the replies as answers if they help and unmark if they don't.- Edited byAland LiMSFT, ModeratorTuesday, May 26, 2009 10:19 AM
-
| | Aland Li Tuesday, May 26, 2009 2:57 AM | Hi Aland Li, I disposed pen and brush.But, I got the same error. //Error:Attempt to read or write protected the memory.This is often an indication that other memory is corrupt. Surendar | | smsurendar Tuesday, May 26, 2009 4:44 AM | Hi smsurendar,
I need detail codes to reappear the error, so please send them to me. You'd better give me other information below: 1. In what control you override function OnPaint. 2.Where the variablesused in OnPaintare defined. 3. The version of your visual studio and the .net framework.
Best Regards, Aland Li
Please mark the replies as answers if they help and unmark if they don't.- Edited byAland LiMSFT, ModeratorTuesday, May 26, 2009 10:19 AM
- Edited byAland LiMSFT, ModeratorTuesday, May 26, 2009 10:17 AM
-
| | Aland Li Tuesday, May 26, 2009 9:14 AM | Hi Aland Li,
One by one i detailed my answer.
1.Form 2.Variable are used in Onpaint. 3.Visualstudio 2005 and .net framework 2.0 Surendar | | smsurendar Tuesday, May 26, 2009 11:58 AM | Hi smsurendar,
I'm sorry that I didn't say my needs clearly. I can't reproduce the problem you met, so I need the detail code to do analyzing and debugging. Could you provide me with the detail code?
From my experience, the error you met is often caused by unmanaged code or external components, so you can trace the context of your code and check whether you used other dll or ActiveX controls. If so, please provide the related code.
This link shows you how to debug a program: http://support.microsoft.com/default.aspx/kb/815788 . This link shows a debug tool: http://msdn2.microsoft.com/en-us/library/a6zb7c8d(VS.80).aspx .
Let me know if this helps.
Best Regards, Aland Li
Please mark the replies as answers if they help and unmark if they don't. | | Aland Li Wednesday, May 27, 2009 6:49 AM | Hi,
We are changing the issue type to “General Discussion�because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question�by opening the Options list at the top of the post window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.
Thanks. Aland Li - Edited byAland LiMSFT, ModeratorMonday, June 01, 2009 12:55 PM
- Edited byAland LiMSFT, ModeratorMonday, June 01, 2009 12:53 PM
-
| | Aland Li Monday, June 01, 2009 12:51 PM | Thank you.. I got the answer.We need to update windows. Surendar- Marked As Answer byAland LiMSFT, ModeratorWednesday, June 03, 2009 7:50 AM
-
| | smsurendar Wednesday, June 03, 2009 6:07 AM |
|