本帖最后由 zl194 于 2009-12-28 15:36:19 编辑

解决方案 »

  1.   

     image.Dispose();
     image = newimage;
    顺序反一下呢..
      

  2.   


      switch (tt)
                            {
                                case 0:
                                    pA = new Point(700, 20);
                                    pB = new Point(700, 35);
                                ^                            default:
                   //这里多了个 ^
                                    pA = new Point(1820, 1160);
                                    pB = new Point(1820, 1175);
                                    break;
                            }
      

  3.   

    Bitmap newimage = new Bitmap(image.Width, image.Height);
                Graphics oGraphic = Graphics.FromImage(newimage);
                Point p00 = new Point(0, 0);
                oGraphic.DrawImage(image, p00);
                image.Dispose();
                image = newimage;看上去这段是多余的  你新建个BMP 不如直接在原来上直接画了
      

  4.   

    如果是GDI+一般性错误,那就是图片文件只读或者文件已经被打开.
      

  5.   

    错误是:
    对话框标题:Microsoft .NET Framework
    内容:
    Unhandled exception has occured in your application If
    you click Continue,the application will ignore this
    error and attemp to contion.If you click Quit,
    the application will close immediatelyA generic error occurred in GDI+详细:
    See the end of this message for details on invoking 
    just-in-time (JIT) debugging instead of this dialog box.************** Exception Text **************
    System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
       at System.Drawing.Graphics.Clear(Color color)
       at System.Windows.Forms.ToolStripSystemRenderer.RenderStatusStripBackground(ToolStripRenderEventArgs e)
       at System.Windows.Forms.ToolStripSystemRenderer.OnRenderToolStripBackground(ToolStripRenderEventArgs e)
       at System.Windows.Forms.ToolStripRenderer.DrawToolStripBackground(ToolStripRenderEventArgs e)
       at System.Windows.Forms.ToolStrip.OnPaintBackground(PaintEventArgs e)
       at System.Windows.Forms.StatusStrip.OnPaintBackground(PaintEventArgs e)
       at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle, Region transparentRegion)
       at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle)
       at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle, Color backColor, Point scrollOffset)
       at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle)
       at System.Windows.Forms.Control.OnPaintBackground(PaintEventArgs pevent)
       at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
       at System.Windows.Forms.Control.WmPaint(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.StatusStrip.RightToLeftLayoutGrip.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.1433 (REDBITS.050727-1400)
        CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    ----------------------------------------
    dmProduction
        Assembly Version: 1.0.0.2
        Win32 Version: 1.0.0.2
        CodeBase: file:///D:/Program%20Files/XXXX系统/dmProduction.exe
    ----------------------------------------
    System.Windows.Forms
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
        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.1433 (REDBITS.050727-1400)
        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.1433 (REDBITS.050727-1400)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    ClassMyDate
        Assembly Version: 1.0.0.4
        Win32 Version: 1.0.0.4
        CodeBase: file:///D:/Program%20Files/XXXX系统/ClassMyDate.DLL
    ----------------------------------------
    System.Data
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
    ----------------------------------------
    System.Configuration
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
        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.1433 (REDBITS.050727-1400)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
    ----------------------------------------
    System.Transactions
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
        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.1433 (REDBITS.050727-1400)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
    ----------------------------------------
    cplan
        Assembly Version: 1.0.0.0
        Win32 Version: 1.0.0.0
        CodeBase: file:///D:/Program%20Files/XXXX系统/cplan.DLL
    ----------------------------------------
    taskprocess
        Assembly Version: 1.0.0.3
        Win32 Version: 1.0.0.3
        CodeBase: file:///D:/Program%20Files/XXX系统/taskprocess.DLL
    ----------------------------------------
    zgraph
        Assembly Version: 1.0.0.1
        Win32 Version: 1.0.0.1
        CodeBase: file:///D:/Program%20Files/XXXX系统/zgraph.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.
      

  6.   

    GDI+ 的一般性错误.  你去查查资料就知道了..
      

  7.   

    会不会跟垃圾回收有关
    因为server和workstation的机制不一样
      

  8.   

    使用了相同的文件名称,或者上次的对象没有Dispose掉  
    解决A generic error occurred in GDI+
      

  9.   

    把image.Dispose();
      image = newimage;
    去掉,然后后面的image的地方都改用newimage试试不太明白为什么要dispose掉image,然后把newimage赋给image再对image操作
      

  10.   

    Bitmap newimage = new Bitmap(image.Width, image.Height);
    Graphics oGraphic = Graphics.FromImage(newimage);
    Point p00 = new Point(0, 0);
    oGraphic.DrawImage(image, p00);
    image.Dispose();
    image = newimage;这段代码的逻辑混乱,究竟是要干什么?
    你可以用一个 Rectangle
    再用Graphics.DrawPie
      

  11.   


    这段我也检查有问题,现在把 image=newimage;去掉了,直接使用newimage,最后返回newimage.
    但还是有同样的错误。我现在开始感觉是win2003的问题了。愁!!
      

  12.   


    这段是有些问题,原想是释放掉image,在新的图像里操作,避免原图像的锁定。现在改了,将image = newimage;去掉了,后面的引用全部使用newimage,并返回newimage.但还是不行。
      

  13.   


    谢谢!光给你一个图像类行吗,别的部分我不能做主,如过你有win2003的环境就帮我测测。
      

  14.   

    这个 image 对象返回后有保存操作吗?