Exemple #1
0
 /// <summary>
 /// On first shown, focus the window.
 /// Could be unfocused if an OpenFileDialog was first opened.
 /// </summary>
 protected override void OnShown(EventArgs e)
 {
     base.OnShown(e);
     this.Activate();
     this.BringToFront();
     UpdateImage(1);
     ImageBox.ShowMessage("Press H for help", 1000);
 }
Exemple #2
0
 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);
     }
 }
Exemple #3
0
        /// <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));
        }