mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-03 06:41:07 +00:00
Avoid using deprecated GLControl.GrabScreenshot() method.
This commit is contained in:
parent
23b2cd74fd
commit
eb04d4996c
|
@ -66,7 +66,9 @@ namespace Examples.WinForms
|
||||||
void glControl_KeyUp(object sender, KeyEventArgs e)
|
void glControl_KeyUp(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.KeyCode == Keys.F12)
|
if (e.KeyCode == Keys.F12)
|
||||||
glControl.GrabScreenshot().Save("screenshot.png");
|
{
|
||||||
|
GrabScreenshot().Save("screenshot.png");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -204,6 +206,23 @@ namespace Examples.WinForms
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region private void GrabScreenshot()
|
||||||
|
|
||||||
|
Bitmap GrabScreenshot()
|
||||||
|
{
|
||||||
|
Bitmap bmp = new Bitmap(this.ClientSize.Width, this.ClientSize.Height);
|
||||||
|
System.Drawing.Imaging.BitmapData data =
|
||||||
|
bmp.LockBits(this.ClientRectangle, System.Drawing.Imaging.ImageLockMode.WriteOnly,
|
||||||
|
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
|
||||||
|
GL.ReadPixels(0, 0, this.ClientSize.Width, this.ClientSize.Height, PixelFormat.Bgr, PixelType.UnsignedByte,
|
||||||
|
data.Scan0);
|
||||||
|
bmp.UnlockBits(data);
|
||||||
|
bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||||
|
return bmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region public static void Main()
|
#region public static void Main()
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in a new issue