/// <summary> /// Go to the specified slide. If it is already shown, then recompute its layout. /// </summary> public void GoToSlide(PMultiSizeImage slide) { if (hiliteSlide != slide) { HiliteSlide(-1); // Unhilite any slide that might be hilited } // First unfocus any slide that has focus if ((focusSlide != null) && (focusSlide != slide)) { ((PMultiSizeImage)focusSlide).ShowThumb = true; focusSlide.AnimateToMatrix(GetUnfocusedMatrix(focusSlide, (int)focusSlide.Tag), ANIMATION_TIME_MILLIS); } // Then set the focus to the new slide focusSlide = slide; if (focusSlide != null) { ((PMultiSizeImage)focusSlide).Hilite = false; PTransformActivity activity = focusSlide.AnimateToMatrix(GetFocusedMatrix(focusSlide), ANIMATION_TIME_MILLIS); activity.ActivityFinished = new ActivityFinishedDelegate(FocusActivityFinished); // Move the current position indicator to the new focus slide's spot in the slide bar LayoutCurrentPosition(); } }
/// <summary> /// Add the given slide at the given index. /// </summary> public void AddSlide(Image hiRes, int index) { int thumbHeight = THUMB_HEIGHT; int thumbWidth = (int)(hiRes.Width * ((float)thumbHeight / hiRes.Height)); // Create thumb manually. Don't use Image.GetThumbnailImage() as it results in images that are very slow to render Image thumb = new Bitmap(thumbWidth, thumbHeight); Graphics g = Graphics.FromImage(thumb); g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.DrawImage(hiRes, 0, 0, thumbWidth, thumbHeight); g.Dispose(); PMultiSizeImage slide = new PMultiSizeImage(thumb, hiRes, true); slide.Tag = index; slideBar.AddChild(slide); slides.Add(slide); }
/// <summary> /// Add the given slide at the given index. /// </summary> public void AddSlide(Image hiRes, int index) { int thumbHeight = THUMB_HEIGHT; int thumbWidth = (int) (hiRes.Width * ((float)thumbHeight / hiRes.Height)); // Create thumb manually. Don't use Image.GetThumbnailImage() as it results in images that are very slow to render Image thumb = new Bitmap(thumbWidth, thumbHeight); Graphics g = Graphics.FromImage(thumb); g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.DrawImage(hiRes, 0, 0, thumbWidth, thumbHeight); g.Dispose(); PMultiSizeImage slide = new PMultiSizeImage(thumb, hiRes, true); slide.Tag = index; slideBar.AddChild(slide); slides.Add(slide); }