我使用以下代码获取屏幕截图:
    public static BitmapSource ToBitmapSource()
    {
        using (var screenBmp = new Bitmap(Convert.ToInt32(System.Windows.SystemParameters.PrimaryScreenWidth), 
            Convert.ToInt32(System.Windows.SystemParameters.PrimaryScreenHeight), 
            System.Drawing.Imaging.PixelFormat.Format32bppArgb))
        {
            using (var bmpGraphics = Graphics.FromImage(screenBmp))
            {
                bmpGraphics.CopyFromScreen(0, 0, 0,
                    0, screenBmp.Size);
                return Imaging.CreateBitmapSourceFromHBitmap(screenBmp.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            }
        }
    }
它适用于普通窗口,但我在 FullScreen 应用程序上得到黑色矩形而不是屏幕截图。为什么以及如何解决?谢谢
