internal static void TextFieldKeyDown(MaterialSingleLineTextField textField, ListBox autocompleteList, Keys keyCode, Button acceptButton) { if (keyCode == Keys.Down && textField.Text.Length >= 3) { autocompleteList.Visible = true; autocompleteList.Focus(); autocompleteList.SelectedIndex = 0; } // Workaround um mit Enter ein Button zu betätigen aber im // Autocomplete Dropdown auf Enter reagieren zu können else if (keyCode == Keys.Enter) { acceptButton.PerformClick(); } }
internal void onDetection(double x, double y) { Action action = () => { double ratio = OS.GetScalingFactor(Handle); Point gazeLocation = new Point((int)(x / ratio), (int)(y / ratio)); var pt = this.videoSourcePlayer.PointToClient(gazeLocation); float normalizeX = pt.X / (float)videoSourcePlayer.Width; float normalizeY = pt.Y / (float)videoSourcePlayer.Height; m_Detector.PointX = normalizeX; m_Detector.PointY = normalizeY; Button focusedButton = this.DescendentsFromPoint(pt).OfType <Button>().LastOrDefault(); if (focusedButton != null) { focusedButton.PerformClick(); } if (Bounds.Contains(pt)) { panelDetectionFrame.Location = gazeLocation; panelDetectionFrame.Visible = true; } else { panelDetectionFrame.Visible = false; } }; this.Invoke(action); MemoryStream frame_MS = CaptureSnapshot(); saveImageLocally(frame_MS); tryToDetect(frame_MS); }