示例#1
0
 public void Execute(ImageSeekCommand cmd, int value)
 {
     if (Format == null || Format.MaxOffset == 0) return;
     int step = value;//e.Control ? 8 : 1;
     CorrectOffset(0);
     int oldOffset = Format.PicOffset;
     int tWidth = Format.Width;
     int tHeight = Format.Height;
     switch (cmd) {
         case ImageSeekCommand.ChangeHeight:
             tHeight += step;
             break;
         case ImageSeekCommand.ChangeWidth:
             tWidth += step;
             break;
         case ImageSeekCommand.ChangeOffsetByte:
             Format.PicOffset += step;
             break;
         case ImageSeekCommand.ChangeOffsetLine:
             Format.PicOffset += Format.LineStride * step;
             break;
         case ImageSeekCommand.ChangeOffsetFrame:
             Format.PicOffset += Format.FrameStride * step;
             break;
         case ImageSeekCommand.ChangeZoom:
             Format.Zoom += value;
             break;
         default:
             throw new InvalidOperationException();
     }
     if (tWidth > 0) Format.Width = tWidth;
     if (tHeight > 0) Format.Height = tHeight;
     CorrectOffset(oldOffset);
 }
示例#2
0
文件: Form1.cs 项目: kael-ip/rippix
        private ToolStripItem CreateSeekCommandItem(string caption, ImageSeekCommand cmd, int step, bool useLeap)
        {
            var item = new ToolStripButton();

            item.Text   = caption;
            item.Click += (s, e) => {
                var leap = ((Control.ModifierKeys & Keys.Shift) != Keys.None) ? 8 : 1;
                seekController.Execute(cmd, useLeap ? step * leap : step);
            };
            return(item);
        }
示例#3
0
        public void Execute(ImageSeekCommand cmd, int value)
        {
            if (Format == null || Format.MaxOffset == 0)
            {
                return;
            }
            int step = value;//e.Control ? 8 : 1;

            CorrectOffset(0);
            int oldOffset = Format.PicOffset;
            int tWidth    = Format.Width;
            int tHeight   = Format.Height;

            switch (cmd)
            {
            case ImageSeekCommand.ChangeHeight:
                tHeight += step;
                break;

            case ImageSeekCommand.ChangeWidth:
                tWidth += step;
                break;

            case ImageSeekCommand.ChangeOffsetByte:
                Format.PicOffset += step;
                break;

            case ImageSeekCommand.ChangeOffsetLine:
                Format.PicOffset += Format.LineStride * step;
                break;

            case ImageSeekCommand.ChangeOffsetFrame:
                Format.PicOffset += Format.FrameStride * step;
                break;

            case ImageSeekCommand.ChangeZoom:
                Format.Zoom += value;
                break;

            default:
                throw new InvalidOperationException();
            }
            if (tWidth > 0)
            {
                Format.Width = tWidth;
            }
            if (tHeight > 0)
            {
                Format.Height = tHeight;
            }
            CorrectOffset(oldOffset);
        }
示例#4
0
文件: Form1.cs 项目: kael-ip/rippix
 private ToolStripItem CreateSeekCommandItem(string caption, ImageSeekCommand cmd, int step, bool useLeap)
 {
     var item = new ToolStripButton();
     item.Text = caption;
     item.Click += (s, e) => {
         var leap = ((Control.ModifierKeys & Keys.Shift) != Keys.None) ? 8 : 1;
         seekController.Execute(cmd, useLeap ? step * leap : step);
     };
     return item;
 }