程序中只要用到CopyFromScreen就报错
 private void Form1_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.CopyFromScreen(this.Location,
        new Point(4, 4), new Size(10, 10));
        }详细错误信息:
未处理 System.ComponentModel.Win32Exception
  Message="操作成功完成。"
  Source="System.Drawing"
  ErrorCode=-2147467259
  NativeErrorCode=0
  StackTrace:
       在 System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
       在 System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize)
       在 System.Drawing.Graphics.CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize)
       在 TestCapture.Form1.Form1_Paint(Object sender, PaintEventArgs e) 位置 D:\测试用例\ZCCapture\TestCapture\Form1.cs:行号 48
       在 System.Windows.Forms.Control.OnPaint(PaintEventArgs e)
       在 System.Windows.Forms.Form.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.Form.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)
       在 TestCapture.Program.Main() 位置 D:\测试用例\ZCCapture\TestCapture\Program.cs:行号 18
       在 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()
  InnerException: 

解决方案 »

  1.   

    同样的代码我这里没有错误你把工程rebuild一下,重新试试
      

  2.   

     e.Graphics.CopyFromScreen(this.Location,
      new Point(4, 4), new Size(10, 10));是不是位置有点不对啊
      

  3.   

    以上说的都不行,这程序我换了几台机器测试了下,有的行有的不行,不知道什么原因。 可不可能是.net framework 装的不行?
      

  4.   

    把.net framework2.0及其相关的东西卸载掉就好了。
    注:我电脑上装了所有版本的.net framework 不晓得是不是产生了冲突,猜测!