Created
December 17, 2016 17:53
-
-
Save dmorrison42/ec31c2edea61dac0c2e28bae3a145edd to your computer and use it in GitHub Desktop.
Capture a hidden dialog c#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async void button1_Click(object sender, EventArgs e) | |
{ | |
await Task.Delay(1000); | |
await Task.Run(() => | |
{ | |
var fileName = @"C:\Users\dan\Desktop\Folder\bitmap.png"; | |
var subwindow = new Slave(); | |
subwindow.ShowInTaskbar = false; | |
subwindow.Show(); | |
subwindow.DesktopLocation = new Point(int.MinValue, int.MinValue); | |
var drawing = new Bitmap(subwindow.Height, subwindow.Width); | |
subwindow.DrawToBitmap(drawing, new Rectangle(new Point(0, 0), new Size(subwindow.Width, subwindow.Height))); | |
drawing.Save(fileName); | |
// Process.Start(fileName); | |
subwindow.Close(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment