It will help you a lot.
To get started,create a new xna windows game.
Add reference to these:System.DrawingSystem.Windows.Forms
And then import them using:
using
System.Drawing;
System.Windows.Forms;
Bitmap screen =
null
;
int
a = 1;
"screen" variable will be used to capture the screen, "a" variable will be used while saving as output.
Now in Update function we will control if any key pressed,if true then we will capture the screen and save it as a output.png(it will be named output1.png,output2.png - depending on "a" variable)
KeyboardState stat = Keyboard.GetState();
System.Drawing.Rectangle bounds = Control.FromHandle(Window.Handle).Bounds;
if
(stat.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape))
{
screen =
new
Bitmap(bounds.Width, bounds.Height);
(Graphics g = Graphics.FromImage(screen))
g.CopyFromScreen(
System.Drawing.Point(bounds.Left, bounds.Top), System.Drawing.Point.Empty, screen.Size);
}
screen.Save(
"output"
+ a +
".png"
, System.Drawing.Imaging.ImageFormat.Png);
a += 1;
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: