/// <summary>
        /// Handles the Changed event of the screen observer control and send it to view range that is defined by getTargetViewRangeForScreenCapturing().
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="tud.mci.tangram.TangramLector.CaptureChangedEventArgs"/> instance containing the event data.</param>
        void so_Changed(object sender, CaptureChangedEventArgs e)
        {
            if (currentView != LectorView.Drawing)
            {
                return;
            }
            BrailleIOViewRange vr = getTargetViewRangeForScreenCapturing();

            if (vr != null && e != null)
            {
                BrailleIOScreen vs = GetVisibleScreen();
                if (vs != null && vs.Name.Equals(BS_MINIMAP_NAME))
                {
                    setMinimapContent(vr, e);
                }
                else
                {
                    vr.SetBitmap(e.Img as Bitmap);
                }
                io.RefreshDisplay(true);
            }
        }
 /// <summary>
 /// Handles the Changed event of the screen observer control and send it to view range that is defined by getTargetViewRangeForScreenCapturing().
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="tud.mci.tangram.TangramLector.CaptureChangedEventArgs"/> instance containing the event data.</param>
 void so_Changed(object sender, CaptureChangedEventArgs e)
 {
     if (currentView != LectorView.Drawing) return;
     BrailleIOViewRange vr = getTargetViewRangeForScreenCapturing();
     if (vr != null && e != null)
     {
         BrailleIOScreen vs = GetVisibleScreen();
         if (vs != null && vs.Name.Equals(BS_MINIMAP_NAME))
         {
             setMinimapContent(vr, e);
         }
         else
         {
             vr.SetBitmap(e.Img as Bitmap);
         }
         io.RefreshDisplay(true);
     }
 }
        /// <summary>
        /// Set the content in minimap mode. Thereby the screen capturing bitmap is shown with blinking frame.
        /// </summary>
        /// <param name="vr">ViewRange in which minimap content should be shown.</param>
        /// <param name="e">EventArgs of the screen capturing event.</param>
        void setMinimapContent(BrailleIOViewRange vr, CaptureChangedEventArgs e)
        {
            int width = vr.ContentBox.Width;
            int height = vr.ContentBox.Height;
            Bitmap bmp = new Bitmap(width, height);
            Graphics graph = Graphics.FromImage(bmp);

            if (screenBeforeMinimap != null)
            {
                BrailleIOViewRange imgvr = screenBeforeMinimap.GetViewRange(VR_CENTER_NAME);
                if (imgvr == null) return;

                int xoffset = imgvr.GetXOffset();
                int yoffset = imgvr.GetYOffset();
                int imgWidth = imgvr.ContentWidth;
                int imgHeight = imgvr.ContentHeight;

                if (imgWidth > 0 && imgHeight > 0)
                {
                    // calculate image size for minimap (complete image has to fit into view range)
                    int imgScaledWidth = imgWidth;
                    int imgScaledHeight = imgHeight;
                    double scaleFactorX = 1;
                    double scaleFactorY = 1;

                    if (width != 0 && imgScaledWidth > width)
                    {
                        scaleFactorX = (double)imgWidth / (double)width;
                        if (scaleFactorX != 0)
                        {
                            imgScaledWidth = width;
                            imgScaledHeight = (int)(imgHeight / scaleFactorX);
                        }
                    }
                    if (height != 0 && imgScaledHeight > height)
                    {
                        scaleFactorY = (double)imgScaledHeight / (double)height;
                        if (scaleFactorY != 0)
                        {
                            imgScaledHeight = height;
                            imgScaledWidth = (int)(imgScaledWidth / scaleFactorY);
                        }
                    }

                    // calculate scaling factor from original image to minimap image size
                    MinimapScalingFactor = 1 / (scaleFactorX * scaleFactorY);
                    double zoom = imgvr.GetZoom();
                    if (zoom > 0) MinimapScalingFactor = MinimapScalingFactor * zoom;

                    // calculate position and size of the blinking frame
                    int x = Math.Abs(xoffset) * imgScaledWidth / imgWidth;
                    int y = Math.Abs(yoffset) * imgScaledHeight / imgHeight;
                    int frameWidth = width * imgScaledWidth / imgWidth;
                    int frameHeigth = height * imgScaledHeight / imgHeight;

                    // draw scaled image and blinking frame
                    graph.DrawImage(e.Img, 0, 0, imgScaledWidth, imgScaledHeight);
                    Color frameColor = Color.Black;
                    if (!blinkPinsUp) frameColor = Color.White;
                    graph.DrawRectangle(new Pen(frameColor, 2), x, y, frameWidth, frameHeigth);
                    vr.SetBitmap(bmp);
                }
            }
        }
        /// <summary>
        /// Set the content in minimap mode. Thereby the screen capturing bitmap is shown with blinking frame.
        /// </summary>
        /// <param name="vr">ViewRange in which minimap content should be shown.</param>
        /// <param name="e">EventArgs of the screen capturing event.</param>
        void setMinimapContent(BrailleIOViewRange vr, CaptureChangedEventArgs e)
        {
            int      width  = vr.ContentBox.Width;
            int      height = vr.ContentBox.Height;
            Bitmap   bmp    = new Bitmap(width, height);
            Graphics graph  = Graphics.FromImage(bmp);

            if (screenBeforeMinimap != null)
            {
                BrailleIOViewRange imgvr = screenBeforeMinimap.GetViewRange(VR_CENTER_NAME);
                if (imgvr == null)
                {
                    return;
                }

                int xoffset   = imgvr.GetXOffset();
                int yoffset   = imgvr.GetYOffset();
                int imgWidth  = imgvr.ContentWidth;
                int imgHeight = imgvr.ContentHeight;

                if (imgWidth > 0 && imgHeight > 0)
                {
                    // calculate image size for minimap (complete image has to fit into view range)
                    int    imgScaledWidth  = imgWidth;
                    int    imgScaledHeight = imgHeight;
                    double scaleFactorX    = 1;
                    double scaleFactorY    = 1;

                    if (width != 0 && imgScaledWidth > width)
                    {
                        scaleFactorX = (double)imgWidth / (double)width;
                        if (scaleFactorX != 0)
                        {
                            imgScaledWidth  = width;
                            imgScaledHeight = (int)(imgHeight / scaleFactorX);
                        }
                    }
                    if (height != 0 && imgScaledHeight > height)
                    {
                        scaleFactorY = (double)imgScaledHeight / (double)height;
                        if (scaleFactorY != 0)
                        {
                            imgScaledHeight = height;
                            imgScaledWidth  = (int)(imgScaledWidth / scaleFactorY);
                        }
                    }

                    // calculate scaling factor from original image to minimap image size
                    MinimapScalingFactor = 1 / (scaleFactorX * scaleFactorY);
                    double zoom = imgvr.GetZoom();
                    if (zoom > 0)
                    {
                        MinimapScalingFactor = MinimapScalingFactor * zoom;
                    }

                    // calculate position and size of the blinking frame
                    int x           = Math.Abs(xoffset) * imgScaledWidth / imgWidth;
                    int y           = Math.Abs(yoffset) * imgScaledHeight / imgHeight;
                    int frameWidth  = width * imgScaledWidth / imgWidth;
                    int frameHeigth = height * imgScaledHeight / imgHeight;

                    // draw scaled image and blinking frame
                    graph.DrawImage(e.Img, 0, 0, imgScaledWidth, imgScaledHeight);
                    Color frameColor = Color.Black;
                    if (!blinkPinsUp)
                    {
                        frameColor = Color.White;
                    }
                    graph.DrawRectangle(new Pen(frameColor, 2), x, y, frameWidth, frameHeigth);
                    vr.SetBitmap(bmp);
                }
            }
        }