//private long pLastImageSwitchTicks = 0; private void UpdateImage(int direction) { _lastDirection = direction; // Set up timer if (_timerCache == null) { _timerCache = new Timer { Interval = 300 }; _timerCache.Tick += (sender, args) => { if (_lastDirection != 0) { int iNext = _fileIndex + _lastDirection; if (iNext == _files.Length) { iNext = 0; } if (iNext < 0) { iNext = _files.Length - 1; } ImageBox.CacheImage(_files[iNext]); } if (_cachedCount >= 3) { _timerCache.Stop(); } else { _cachedCount++; } }; } // Stop the cache timer _timerCache.Stop(); this.Text = string.Format("{0} - Image Viewer", System.IO.Path.GetFileName(currentFile)); ImageBox.LoadImage(currentFile); // Start caching timer _cachedCount = 0; _timerCache.Start(); }
private void AutoPlay() { if (_autoPlayTimer == null) { _autoPlayTimer = new Timer { Interval = 2000 }; _autoPlayTimer.Tick += (s, e) => { NextImage(); }; } if (_autoPlayTimer.Enabled) { _autoPlayTimer.Stop(); ImageBox.ShowMessage("Autoplay OFF", 900); } else { _autoPlayTimer.Start(); ImageBox.ShowMessage("Autoplay ON", 900); } }
private void ImageBox_MouseEnter(object sender, EventArgs e) { ImageBox.Focus(); }
/// <summary> /// Hotkeys /// </summary> protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { switch (keyData) { // Left: previous image case Keys.Left: PreviousImage(); return(true); // Right: next image case Keys.Right: NextImage(); return(true); // "R": Rotate image case Keys.R: RotateImage(); return(true); // [shift][R]: Rotate image CCW case Keys.R | Keys.Shift: RotateImageInv(); return(true); // [F]: Toggle fullscreen case Keys.F: ToggleFullScreen(); return(true); // [Esc] close topmost -> quit case Keys.Escape: if (this.TopMost) { ToggleFullScreen(); } else { this.Close(); } return(true); // [H]: Show help text case Keys.H: if (ImageBox.HasMessage) { ImageBox.HideMessage(); } else { ImageBox.ShowMessage(Program.GetResource("helptext.txt"), 10000); } return(true); // [Q]: Quit case Keys.Q: this.Close(); return(true); // [T] Toggle topmost case Keys.T: this.TopMost = !this.TopMost; return(true); // 1 : Switch between 100% and best fit case Keys.D1: if (ImageBox.Zoom != 1) { ImageBox.Zoom = 1; } else { ImageBox.Zoom = 0; ImageBox.ResetTransform(); } return(true); // [B] Toggle borderless case Keys.B: ToggleBorderless(); return(true); // [C] Copy file name case Keys.C: Clipboard.SetText(currentFile); return(true); // [A] Toggle autoplay case Keys.A: AutoPlay(); return(true); } return(base.ProcessCmdKey(ref msg, keyData)); }
private void BottomPanel_MouseEnter(object sender, EventArgs e) { ImageBox.Focus(); //ChangeCursor(); }