public static Bitmap CopyPrimaryScreen()
        {
            Screen s = Screen.PrimaryScreen;
            Rectangle r = s.Bounds;
            int w = r.Width;
            int h = r.Height;
            Bitmap bmp = new Bitmap(w, h);
            Graphics g = Graphics.FromImage(bmp);
            g.CopyFromScreen
            (
            new Point(0, 0),
            new Point(0, 0),
            new Size(w, h)
            );
            return bmp;
        }
==========================================================
创个按键点击使用上面代码,保存到C盘A.BMP。不会搞,谁会教一下,谢谢啦

解决方案 »

  1.   

    参考:http://www.cnblogs.com/zhili/p/CaptureTool.html
      

  2.   


    btnClick:
        Bitmap bitmap=CopyPrimaryScreen();
        bitmap.Save("C:\\A.bmp");
        bitmap.Dispose();
      

  3.   


    public static Bitmap CopyPrimaryScreen()
    {
        Screen s = Screen.PrimaryScreen;
        Rectangle r = s.Bounds;
        int w = r.Width;
        int h = r.Height;
        Bitmap bmp = new Bitmap(w, h,System.Drawing.Imaging.PixelFormat.Format32bppArgb);
        Graphics g = Graphics.FromImage(bmp);
        g.CopyFromScreen
        (
           new Point(0, 0),
           new Point(0, 0),
           new Size(w, h)
        );
        return bmp;
    }
    btnClick:
        Bitmap bitmap=CopyPrimaryScreen();
        bitmap.Save("C:\\A.bmp",System.Drawing.Imaging.ImageFormat.Png);
        bitmap.Dispose();
      

  4.   

    hwenycocodq520  非常感谢。 完全是可以的。哈哈,不用设屏示器了。结帐。谢谢大家。