public TakeScreenshot ( string filename ) : void | ||
filename | string | The filename. |
Résultat | void |
public void CanSwitchBetweenRenderWindowsWhenRenderingIsDoneInAControl() { using (var form = new Form()) { form.ClientSize = new Size(1024, 760); var button = new Button { Size = new Size(800, 600), Top = 112, Left = 80, Parent = form }; IntPtr handle = button.Handle; IRenderWindow renderWindow = new XnaRenderWindow(handle); button.KeyPress += delegate(object sender, KeyPressEventArgs args) { if (args.KeyChar == 'p') { renderWindow.TakeScreenshot("test.bmp"); } else if (args.KeyChar == 's') { if (renderWindow is XnaRenderWindow) { renderWindow.Dispose(); renderWindow = new SlimDXRenderWindow(handle); } else { renderWindow.Dispose(); renderWindow = new XnaRenderWindow(handle); } } }; Application.Idle += delegate { renderWindow.Render(); Application.DoEvents(); }; Application.Run(form); if (renderWindow != null) { renderWindow.Dispose(); } } }
public void CanSwitchBetweenRenderWindows() { using (var form = new Form()) { form.ClientSize = new Size(800, 600); IRenderWindow renderWindow = new XnaRenderWindow(form.Handle); form.KeyPress += delegate(object sender, KeyPressEventArgs args) { if (args.KeyChar == 'p') { renderWindow.TakeScreenshot("test.bmp"); } else if (args.KeyChar == 's') { if (renderWindow is XnaRenderWindow) { renderWindow.Dispose(); renderWindow = new SlimDXRenderWindow(form.Handle); } else { renderWindow.Dispose(); renderWindow = new XnaRenderWindow(form.Handle); } } }; Application.Idle += delegate { renderWindow.Render(); Application.DoEvents(); }; Application.Run(form); if (renderWindow != null) { renderWindow.Dispose(); } } }