/// <summary> /// This method creates a new thumb for this slide. /// </summary> private void RecreateThumb() { Bitmap newThumb = new Bitmap(SlideDesignThumbSize.Width, SlideDesignThumbSize.Height); using (Graphics g = Graphics.FromImage(newThumb)) { float factorX = (float)newThumb.Width / this.PresentationSize.Width; float factorY = (float)newThumb.Height / this.PresentationSize.Height; if (factorX != 0 && factorY != 0) { g.ScaleTransform(factorX, factorY); } this.Draw(g); foreach (VGElement element in this.ActiveXStimuli) { if (element is VGBrowser) { VGBrowser browser = element as VGBrowser; Image browserThumb = CreateBrowserThumb(browser.BrowserURL, this.PresentationSize); g.DrawImage(browserThumb, Point.Empty); } } } newThumb.Tag = this.Name; this.thumb = newThumb; }
/// <summary> /// This method creates a <see cref="Slide"/> containing the<see cref="VGBrowser"/> /// that can be used to display the website described in the /// given <see cref="BrowserTreeNode"/> /// </summary> /// <param name="browserSlide">The <see cref="BrowserTreeNode"/> to be converted into a /// presentation slide.</param> /// <returns>A <see cref="Slide"/> containing the <see cref="VGBrowser"/> /// that displays the web site.</returns> private Slide CreateBrowserSlide(BrowserTreeNode browserSlide) { Slide slide = (Slide)browserSlide.Slide.Clone(); VGBrowser browser = new VGBrowser( ShapeDrawAction.None, browserSlide.OriginURL, browserSlide.BrowseDepth, Pens.Black, Brushes.Black, SystemFonts.DefaultFont, Color.Black, PointF.Empty, Document.ActiveDocument.PresentationSize, VGStyleGroup.ACTIVEX, browserSlide.Name, string.Empty); slide.ActiveXStimuli.Add(browser); return(slide); }
/// <summary> /// This method loads the given slide content into the background of the /// <see cref="Picture"/>. If applicable any flash objects are /// initialized /// </summary> /// <param name="slide">The new <see cref="Slide"/> to be displayed in the /// background of the <see cref="Picture"/>.</param> /// <param name="activeXMode">The <see cref="ActiveXMode"/> that should /// be used to display slide and activeX controls. Use this /// to display them on top or in the background.</param> protected void LoadSlide(Slide slide, ActiveXMode activeXMode) { // This releases the resources of the used slide // including explicit disposing of flash objects this.Picture.ResetBackground(); if (slide == null) { return; } // Set presentation size slide.PresentationSize = Document.ActiveDocument.PresentationSize; if (slide.StimulusSize != Size.Empty) { this.Picture.StimulusSize = slide.StimulusSize; } else { this.Picture.StimulusSize = slide.PresentationSize; } this.Picture.PresentationSize = slide.PresentationSize; Slide slideCopy = (Slide)slide.Clone(); switch (activeXMode) { case ActiveXMode.Off: // set Pictures new background slide this.Picture.BgSlide = slideCopy; break; default: case ActiveXMode.BehindPicture: // set Pictures new background slide this.Picture.BgSlide = slideCopy; foreach (VGElement element in slideCopy.ActiveXStimuli) { if (element is VGFlash) { VGFlash flash = element as VGFlash; flash.InitializeOnControl(this.Picture.Parent, false, this.Picture.StimulusToScreen); } else if (element is VGBrowser) { // Don´t show browser control, use screenshot of whole website instead. // VGBrowser browser = element as VGBrowser; // browser.InitializeOnControl(this.Picture.Parent, false); } } break; case ActiveXMode.OnTop: // set Pictures new background slide this.Picture.BgSlide = slideCopy; foreach (VGElement element in slideCopy.ActiveXStimuli) { if (element is VGFlash) { VGFlash flash = element as VGFlash; flash.InitializeOnControl(this.Picture, false, this.Picture.StimulusToScreen); } else if (element is VGBrowser) { VGBrowser browser = element as VGBrowser; browser.InitializeOnControl(this.Picture, false); } } break; case ActiveXMode.Video: // Don´t use Slide this.Picture.BgSlide = null; break; } // Set autozoom, because websites could have changed in size this.AutoZoomPicture(); // Redraw picture this.Picture.Invalidate(); }