private void btnHelp_Click(object sender, EventArgs e) { Process p; try { p = Process.GetProcessById(this.process_id); } catch { return; } PrettyClick.ScreenCapture capture = new PrettyClick.ScreenCapture(); PrettyClick.ScreenshotForm form = new PrettyClick.ScreenshotForm(); Image screen = capture.CaptureWindow(p.MainWindowHandle); form.BackgroundImage = screen; form.Size = screen.Size; form.Duration = 2; form.StartPosition = FormStartPosition.Manual; form.Location = new Point(0, 0); form.ShowDialog(); }
public void trackLocation() { System.Timers.Timer t = new System.Timers.Timer(1000); t.Elapsed += (a, b) => { Process p; try { p = Process.GetProcessById(this.process_id); } catch { return; } ScreenCapture sc = new ScreenCapture(); var position = sc.getWindowRect(p.MainWindowHandle); var form = this.Parent; form.Invoke(new Action(() => { form.Location = new Point(position.Left + position.Width - form.Width, position.Top); })); }; t.Start(); }