Ejemplo n.º 1
0
        protected void OnScreenshotReceive(object sender, ScreenshotReceivedEventArgs e)
        {
            if (e.Fullscreen)
            {
                //Bounds = e.Bounds;
            }

            //Ratio = (float)this.imageView.Bounds.Width / (float)Bounds.Width;

            /*if (this.imageView.InvokeRequired)
             * {
             *      SetDrawingAreaHeightCallback d = new SetDrawingAreaHeightCallback(setDrawingAreaHeight);
             *      this.Invoke(d, new object[] { (int)((float)Bounds.Height * Ratio) });
             * }
             * else
             * {
             *      setDrawingAreaHeight((int)((float)Bounds.Height * Ratio));
             * }*/

            if (e.Nothing)
            {
                return;
            }

            if (e.SystemId == this.SystemId)
            {
                using (var stream = new MemoryStream(e.Image))
                {
                    NSImage image = NSImage.FromStream(stream);

                    drawImage(image);
                }
            }
        }
Ejemplo n.º 2
0
        protected void OnScreenshotReceive(object sender, ScreenshotReceivedEventArgs e)
        {
            if (e.Fullscreen)
            {
                Bounds = e.Bounds;
            }

            Ratio = (float)this.drawingArea1.Width / (float)Bounds.Width;

            if (this.drawingArea1.InvokeRequired)
            {
                SetDrawingAreaHeightCallback d = new SetDrawingAreaHeightCallback(setDrawingAreaHeight);
                this.Invoke(d, new object[] { (int)((float)Bounds.Height * Ratio) });
            }
            else
            {
                setDrawingAreaHeight((int)((float)Bounds.Height * Ratio));
            }

            if (e.Nothing)
            {
                return;
            }

            if (e.SystemId == this.SystemId)
            {
                using (var stream = new MemoryStream(e.Image))
                {
                    Image image = Image.FromStream(stream);

                    if (this.drawingArea1.InvokeRequired)
                    {
                        DrawImageCallback d = new DrawImageCallback(drawImage);
                        this.Invoke(d, new object[] { image, e.Bounds });
                    }
                    else
                    {
                        drawImage(image, e.Bounds);
                    }
                }
            }
        }