public bool KeyDownGlobal(Hooking.GlobalKeyEventHandlerArgs e) { if (e.VirtualKeyCode == _config.RecordShortcut) { if (_recorder.IsRunning) { stopMacro(); } else { lblStatus.Text = "Status: Recording"; _recorder.Clear(); _recorder.StartRecording(); } return(false); } if (e.VirtualKeyCode == _config.PlayShortcut) { if (_player.IsPlaying) { _player.CancelPlayback(); } else { playMacro(); } return(false); } if (e.VirtualKeyCode == _config.CaptureShortcut && _recorder.IsRunning) { string basePath = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\" + _config.FilePrefix; if (!System.IO.Directory.Exists(basePath)) { Directory.CreateDirectory(basePath); } Guid guid = Guid.NewGuid(); string tempPath = basePath + "\\" + _config.FilePrefix + guid + ".bmp"; int offsetPointx = int.Parse(_config.Offset.Split(',')[0]) * _config.CaptureWidth / 100; int offsetPointy = int.Parse(_config.Offset.Split(',')[1]) * _config.CaptureHeight / 100; //System.Drawing.Point destinationPoint = new System.Drawing.Point((int)_recorder.CurrentXY.X + _config.CaptureWidth, (int)_recorder.CurrentXY.Y + _config.CaptureHeight); System.Drawing.Point destinationPoint = new System.Drawing.Point((int)_recorder.CurrentXY.X + offsetPointx, (int)_recorder.CurrentXY.Y + offsetPointy); //System.Drawing.Point sourcePoint = new Point((int)_recorder.CurrentXY.X, (int)_recorder.CurrentXY.Y); System.Drawing.Point sourcePoint = new Point((int)_recorder.CurrentXY.X - offsetPointx, (int)_recorder.CurrentXY.Y - offsetPointy); ImageProcessing.CaptureImage(sourcePoint, destinationPoint, tempPath, "bmp"); _recorder.CurrentMacro.AddEvent(new MacroWaitImageEvent(tempPath.Replace("\\", "\\\\"))); return(false); } return(true); }
public bool KeyDownGlobal(Hooking.GlobalKeyEventHandlerArgs e) { if (record) { txtRecord.Text = ""; txtRecord.Text = e.VirtualKeyCode.ToString(); return(false); } else if (play) { txtPlay.Text = ""; txtPlay.Text = e.VirtualKeyCode.ToString(); return(false); } else if (capture) { txtCapture.Text = ""; txtCapture.Text = e.VirtualKeyCode.ToString(); return(false); } return(true); }