private void AlignFormClick(object sender, AlignFormEventArgs eventArgs)
        {
            switch (eventArgs.AlignButtonClicked)
            {
            case AlignButtonClick.LeftAlign:
                PannablePictureBox.AlignLeft();
                break;

            case AlignButtonClick.BottomAlign:
                PannablePictureBox.AlignBottom();
                break;

            case AlignButtonClick.RightAlign:
                PannablePictureBox.AlignRight();
                break;

            case AlignButtonClick.TopAlign:
                PannablePictureBox.AlignTop();
                break;

            case AlignButtonClick.XAlign:
                PannablePictureBox.AlignXMiddle();
                break;

            case AlignButtonClick.YAlign:
                PannablePictureBox.AlignYMiddle();
                break;

            case AlignButtonClick.NudgeUp:
                PannablePictureBox.Nudge(y: -1);
                break;

            case AlignButtonClick.NudgeDown:
                PannablePictureBox.Nudge(y: 1);
                break;

            case AlignButtonClick.NudgeLeft:
                PannablePictureBox.Nudge(-1);
                break;

            case AlignButtonClick.NudgeRight:
                PannablePictureBox.Nudge(1);
                break;

            case AlignButtonClick.Center:
                PannablePictureBox.CenterImage();
                break;

            case AlignButtonClick.Unknown:
            default:
                throw new ArgumentOutOfRangeException(nameof(eventArgs.AlignButtonClicked), eventArgs.AlignButtonClicked, null);
            }
        }
Example #2
0
        private void DoAdjustement(ImageZoomAdjustement adjustementType)
        {
            switch (adjustementType)
            {
            case ImageZoomAdjustement.Enlarge:
                PannablePictureBox.EnlargeImage();
                break;

            case ImageZoomAdjustement.Shrink:
                PannablePictureBox.ShrinkImage();
                break;

            case ImageZoomAdjustement.None:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(adjustementType), adjustementType, null);
            }
        }
 private void btnReset_Click(object sender, EventArgs e)
 {
     PannablePictureBox.ResetImage();
 }
 private void tmrEnlarge_Tick(object sender, EventArgs e)
 {
     PannablePictureBox.EnlargeImage();
 }
 public void UpdateTrackBarAndZoom()
 {
     trkZoom.Value = (int)Math.Round(PannablePictureBox.GetZoomPercentage(), 1);
     UpdateZoomPercentage();
 }
 private void UpdateZoomPercentage()
 {
     lblPercent.Text = $@"{PannablePictureBox.GetZoomPercentage().ToString("F")}%";
 }
 private void trkZoom_Scroll(object sender, EventArgs e)
 {
     PannablePictureBox.SetZoom(trkZoom.Value);
     UpdateZoomPercentage();
 }
 private void tmrShrink_Tick(object sender, EventArgs e)
 {
     PannablePictureBox.ShrinkImage();
 }
 private void btnEnlarge_MouseUp(object sender, MouseEventArgs e)
 {
     PannablePictureBox.EndContinuousAdjustment();
 }
 private void btnEnlarge_MouseDown(object sender, MouseEventArgs e)
 {
     PannablePictureBox.BeginContinuousAdjustment(PannableImageContinuousAdjustement.Enlarge);
 }
 public void SetPannablePictureBoxControl(PannablePictureBox value)
 {
     PannablePictureBox = value;
     PannablePictureBox.OnPannablePictureImagePropertyChange += (o, args) => UpdateControls();
 }