private void button1_Click(object sender, EventArgs e) { WindowLayer mc = new WindowLayer(); mc.OutputDescription = "Camera Mode Enabled"; mc.Show(); }
private void KeyboardHookInstance_KeyIntercepted(KeyboardHookEventArgs keyboardEvents) { skImage myImage = null; Bitmap i; if (keyboardEvents.PressedKey == Keys.PrintScreen) { switch (CurrentMode) { case mode.FullScreen: i = skImageCapture.GetDesktopWindowCaptureAsBitmap(); myImage = new skImage(i); break; case mode.CameraMode: this.Hide(); if (!instanceCreated) { mc = new WindowLayer(); instanceCreated = true; mc.Show(); } else { WindowFrameToCapture = mc.GetWindowFrame(); i = skImageCapture.CaptureDeskTopRectangle(WindowFrameToCapture, WindowFrameToCapture.Width, WindowFrameToCapture.Height); myImage = new skImage(i); mc.Dispose(); mc = null; instanceCreated = false; } break; case mode.HighlightMode: this.Hide(); if (!instanceCreated) { mc = new WindowLayer(); instanceCreated = true; mc.Show(); } else { WindowFrameToCapture = mc.GetWindowFrame(); i = skImageCapture.GetDesktopWindowCaptureAsBitmap(); myImage = new skImage(i, WindowFrameToCapture); mc.Dispose(); mc = null; instanceCreated = false; } break; default: MessageBox.Show("unable to capture screen"); break; } if (myImage != null) { Common.ShowToastForm(myImage); } } }