Example #1
0
    /// <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();
    }
Example #2
0
        /// <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();
        }