示例#1
0
        public static Bitmap GetWindowImage(Control ctrl)
        {
            Bitmap bmp = GetWindowImage(PlatformInvokeUSER32.GetDC(
                                            ctrl.Handle));
            //Recadre l'image (qui fait parfois la taille de tout l'écran
            Bitmap   newBmp = new Bitmap(ctrl.ClientSize.Width, ctrl.ClientSize.Height);
            Graphics g      = Graphics.FromImage(newBmp);

            g.DrawImage(bmp, 0, 0);
            g.Dispose();
            bmp.Dispose();
            return(newBmp);
        }
示例#2
0
 public static Bitmap GetDesktopImage( )
 {
     return(GetWindowImage(PlatformInvokeUSER32.GetDC
                               (PlatformInvokeUSER32.GetDesktopWindow())));
 }