我的程序里的pictureBox显示完图像后,出现了一个大红色的差号,这是怎么回事啊?

解决方案 »

  1.   

    是显示完成以后显示一个红叉?是不是你程序中有什么设定?给出代码看看。
    在PictureBox中可以同时设置InitialImage,Image和ErrorImage,是不是你切换了显示?
      

  2.   

    我设置的是image属性,
    创建一个bmp文件
    pictureBox.image=bmp文件。
      

  3.   

    没有路径呀,bmp是动态创建的,然后赋值给picturebox.image
    我在网吧里,没带源码,请原谅。
    bitmap bit=new bitmap(width,height);
    graphics g = graphics.fromImage(bit);
    pictureBox1.image=bit;然后:线程中控制画图,
    bit:是外部系统采集到的图像。
    g.drawImage(bit,位置);线程画完之后,图像能够保存,而且放大缩小都可以,就是显示大红叉,就是显示有问题。
    保存图像:picturebox1.image.save(路径,格式),很OK呀,就是显示不出来啊。
    怎么回事啊????大侠帮忙!!!!
      

  4.   

    pictureBox有一个ErrorImage属性,设置试试
      

  5.   

    我也刚遇到,是图像的路径错误,然后ErrorImage的值就是默认为“+
      

  6.   

    晚上好,问题还没解决呀,怎么样才能加分啊。picturebox中的图像是存在的,我在程序中还可以保存图像的 啊,并且出叉之后,我还可以将其放大,放大的图像显示在另外窗体上,效果很好,但就是picturebox中显示不出来,我晕了。救命啊
    请参见此消息的结尾。************** 异常文本 **************
    System.InvalidOperationException: 对象当前正在其他地方使用。
       在 System.Drawing.Image.get_RawFormat()
       在 System.Drawing.Graphics.IgnoreMetafileErrors(Image image, Int32& errorStatus)
       在 System.Drawing.Graphics.DrawImage(Image image, Int32 x, Int32 y, Int32 width, Int32 height)
       在 System.Drawing.Graphics.DrawImage(Image image, Rectangle rect)
       在 System.Windows.Forms.PictureBox.OnPaint(PaintEventArgs pe)
       在 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.Control.ControlNativeWindow.OnMessage(Message& m)
       在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    ************** 已加载的程序集 **************
    mscorlib
        程序集版本: 2.0.0.0
        Win32 版本: 2.0.50727.42 (RTM.050727-4200)
        基本代码: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    ----------------------------------------
    X_Machine
        程序集版本: 1.0.0.0
        Win32 版本: 1.0.0.0
        基本代码: file:///D:/X_project/X_project/X_Machine/X_Machine/bin/Debug/X_Machine.exe
    ----------------------------------------
    System.Windows.Forms
        程序集版本: 2.0.0.0
        Win32 版本: 2.0.50727.42 (RTM.050727-4200)
        基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    ----------------------------------------
    System
        程序集版本: 2.0.0.0
        Win32 版本: 2.0.50727.42 (RTM.050727-4200)
        基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    System.Drawing
        程序集版本: 2.0.0.0
        Win32 版本: 2.0.50727.42 (RTM.050727-4200)
        基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    xraymachineForm
        程序集版本: 1.0.0.0
        Win32 版本: 1.0.0.0
        基本代码: file:///D:/X_project/X_project/X_Machine/X_Machine/bin/Debug/xraymachineForm.DLL
    ----------------------------------------
    Communication
        程序集版本: 1.0.0.0
        Win32 版本: 1.0.0.0
        基本代码: file:///D:/X_project/X_project/X_Machine/X_Machine/bin/Debug/Communication.DLL
    ----------------------------------------
    System.Configuration
        程序集版本: 2.0.0.0
        Win32 版本: 2.0.50727.42 (RTM.050727-4200)
        基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
    ----------------------------------------
    System.Xml
        程序集版本: 2.0.0.0
        Win32 版本: 2.0.50727.42 (RTM.050727-4200)
        基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
    ----------------------------------------
    pcdig
        程序集版本: 1.0.3189.26168
        Win32 版本: 
        基本代码: file:///D:/X_project/X_project/X_Machine/X_Machine/bin/Debug/pcdig.DLL
    ----------------------------------------
    msvcm80d
        程序集版本: 8.0.50608.0
        Win32 版本: 8.00.50727.42
        基本代码: file:///C:/WINDOWS/WinSxS/x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_f75eb16c/msvcm80d.dll
    ----------------------------------------
    AxInterop.DTControl
        程序集版本: 1.0.0.0
        Win32 版本: 1.0.0.0
        基本代码: file:///D:/X_project/X_project/X_Machine/X_Machine/bin/Debug/AxInterop.DTControl.DLL
    ----------------------------------------
    System.Windows.Forms.resources
        程序集版本: 2.0.0.0
        Win32 版本: 2.0.50727.42 (RTM.050727-4200)
        基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_zh-CHS_b77a5c561934e089/System.Windows.Forms.resources.dll
    ----------------------------------------
    Interop.DTControl
        程序集版本: 1.0.0.0
        Win32 版本: 1.0.0.0
        基本代码: file:///D:/X_project/X_project/X_Machine/X_Machine/bin/Debug/Interop.DTControl.DLL
    ----------------------------------------
    dataManage
        程序集版本: 1.0.0.0
        Win32 版本: 1.0.0.0
        基本代码: file:///D:/X_project/X_project/X_Machine/X_Machine/bin/Debug/dataManage.DLL
    ----------------------------------------
    System.Data
        程序集版本: 2.0.0.0
        Win32 版本: 2.0.50727.42 (RTM.050727-4200)
        基本代码: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
    ----------------------------------------
    System.Transactions
        程序集版本: 2.0.0.0
        Win32 版本: 2.0.50727.42 (RTM.050727-4200)
        基本代码: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
    ----------------------------------------
    System.EnterpriseServices
        程序集版本: 2.0.0.0
        Win32 版本: 2.0.50727.42 (RTM.050727-4200)
        基本代码: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
    ----------------------------------------
    mscorlib.resources
        程序集版本: 2.0.0.0
        Win32 版本: 2.0.50727.42 (RTM.050727-4200)
        基本代码: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    ----------------------------------------
    System.Drawing.resources
        程序集版本: 2.0.0.0
        Win32 版本: 2.0.50727.42 (RTM.050727-4200)
        基本代码: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing.resources/2.0.0.0_zh-CHS_b03f5f7f11d50a3a/System.Drawing.resources.dll
    ----------------------------------------************** JIT 调试 **************
    要启用实时(JIT)调试,
    该应用程序或计算机的 .config 文件(machine.config)的 system.windows.forms 节中必须设置
    jitDebugging 值。
    编译应用程序时还必须启用
    调试。例如: <configuration>
        <system.windows.forms jitDebugging="true" />
    </configuration>启用 JIT 调试后,任何无法处理的异常
    都将被发送到在此计算机上注册的 JIT 调试器,
    而不是由此对话框处理。