本帖最后由 cnyyk 于 2014-05-10 01:12:43 编辑

解决方案 »

  1.   

    System.AccessViolationException was unhandled
      Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
      Source=System.Drawing
      StackTrace:
           at System.Drawing.SafeNativeMethods.Gdip.GdipDrawLineI(HandleRef graphics, HandleRef pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2)
           at System.Drawing.Graphics.DrawLine(Pen pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2)
           at System.Windows.Forms.GroupBox.DrawGroupBox(PaintEventArgs e)
           at System.Windows.Forms.GroupBox.OnPaint(PaintEventArgs e)
           at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
           at System.Windows.Forms.Control.WmPaint(Message& m)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.GroupBox.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.Run(Form mainForm)
           at WindowsFormsApplication2.Program.Main() in e:\home\documents\visual studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\Program.cs:line 18
           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException: 
      

  2.   

    Found the solution that worked for me. Either upgrade or rollback your video drivers.I have a Radeon HD6950 with driver version 9.00.100.10. When I rolled back the driver to version 8.980.0.0. the "gdipdrawline" errors stopped. This means all the controls that used the function now also work. I can confirm working the GroupBox and the DataGridView as they previously crashed with the same or similar call stacks.
    http://stackoverflow.com/questions/18245212/graphics-drawline-accessviolation-visual-studio-ide貌似我刚更新了显卡驱动。可能是这个问题干。