//打开shot界面 private void openShot(string kind) { if (ifHiden == WindowHideMode.Hide) { WindowState = WindowState.Minimized; Thread.Sleep(100); } CaptureWindow captureWindow = new CaptureWindow(); photoName = "\\" + counter.ToString() + ".jpg"; counter += 1; Shot shot = new Shot(captureWindow.GetPic_Desktop(), photosPath + photoName, kind); shot.Topmost = true; shot.WindowStyle = System.Windows.WindowStyle.None; shot.WindowState = System.Windows.WindowState.Maximized; shot.ShowDialog(); if (ifHiden == WindowHideMode.Hide) { Thread.Sleep(100); WindowState = WindowState.Normal; } updatePhotoes(); serverData.setFileCounter(counter); }
//全屏截图 private void fullShot() { if (ifHiden == WindowHideMode.Hide) { WindowState = WindowState.Minimized; Thread.Sleep(200); } CaptureWindow captureWindow = new CaptureWindow(); photoName = "\\" + counter.ToString() + ".jpg"; counter += 1; try { captureWindow.GetPic_Desktop().Save(photosPath + photoName); } catch (Exception e) { fullShot(); } if (ifHiden == WindowHideMode.Hide) { Thread.Sleep(200); WindowState = WindowState.Normal; } updatePhotoes(); serverData.setFileCounter(counter); }
private void MainWindow_MouseDown_Hide(object sender, MouseButtonEventArgs e) { WindowState = WindowState.Minimized; Thread.Sleep(50); _downPoint = System.Windows.Forms.Control.MousePosition; hWnd = WindowFromPoint(_downPoint.X, _downPoint.Y); SwitchToThisWindow(hWnd, true); Thread.Sleep(50); CaptureWindow captureWindow = new CaptureWindow(); img = captureWindow.GetPic_Desktop(); setBackground(); WindowState = WindowState.Maximized; ifShot = true; }