private void FlyIn() { if (currentIndex > -1) { currentImgRect = ImageDisplayModeHelper.GetImageRect( this.ClientRectangle, new Rectangle(Point.Empty, imgs[currentIndex].Size), DisplayMode.ScaleLossLessCenter); direction = -1; s = (int)(0.5 * (this.Width + currentImgRect.Width)); vCurrentHor = s / step + ((s % step == 0) ? 0 : 1); } // newImgRect = ImageDisplayModeHelper.GetImageRect( this.ClientRectangle, new Rectangle(Point.Empty, imgs[newIndex].Size), DisplayMode.ScaleLossLessCenter); int offsetSizeHor = 40; int offsetSizeVer = (int)(offsetSizeHor * 1f * newImgRect.Height / newImgRect.Width); vNewHor = 1f * offsetSizeHor / step; vNewVer = 1f * offsetSizeVer / step; newImgRect = newImgRect.AdjustSizeFromCenter(-offsetSizeHor, -offsetSizeVer); flyinAnim.Start(); }
private void FlyOut() { // setup to reduce size of new image currentImgRect = ImageDisplayModeHelper.GetImageRect( this.ClientRectangle, new Rectangle(Point.Empty, imgs[currentIndex].Size), DisplayMode.ScaleLossLessCenter); int offsetSizeHor = 40; int offsetSizeVer = (int)(offsetSizeHor * 1f * currentImgRect.Height / currentImgRect.Width); vNewHor = -1f * offsetSizeHor / step; vNewVer = -1f * offsetSizeVer / step; // newImgRect = ImageDisplayModeHelper.GetImageRect( this.ClientRectangle, new Rectangle(Point.Empty, imgs[newIndex].Size), DisplayMode.ScaleLossLessCenter); // setup prev image on the left newImgRect = newImgRect.AdjustXF(-newImgRect.Right); // and move direction is to the right direction = 1; s = (int)(0.5 * (this.Width + newImgRect.Width)); vCurrentHor = s / step; flyoutAnim.Start(); }
private void RecalcImageRect() { currentImgRect = ImageDisplayModeHelper.GetImageRect( this.ClientRectangle, new Rectangle(Point.Empty, imgs[currentIndex].Size), DisplayMode.ScaleLossLessCenter); newImgRect = Rectangle.Empty; }