Пример #1
0
        public void Draw(WidgetDrawArgs args)
        {
            if (args.Sample)
            {
                return;
            }
            if (_props.SourceMonitor <= 0)
            {
                return;
            }
            if (_props.DestinationMonitor <= 0)
            {
                return;
            }

            var screens = new ScreenList();

            if (_props.SourceMonitor > screens.Count)
            {
                return;
            }

            // Capture the source bitmap
            var srcScreen = screens[_props.SourceMonitor - 1];

            using (var srcBmp = new Bitmap(srcScreen.Bounds.Width, srcScreen.Bounds.Height))
                using (var g = Graphics.FromImage(srcBmp))
                {
                    g.CopyFromScreen(srcScreen.Bounds.Left, srcScreen.Bounds.Top, 0, 0, srcScreen.Bounds.Size);
                    args.Graphics.DrawImage(srcBmp, args.Bounds.Left, args.Bounds.Top, args.Bounds.Width, args.Bounds.Height);
                }
        }
Пример #2
0
        public void Draw(WidgetDrawArgs args)
        {
            if (args.Sample)
            {
                return;
            }
            if (!_props.Horizontal && !_props.Vertical)
            {
                return;
            }

            using (var img = new Bitmap(args.Bounds.Width, args.Bounds.Height, args.Graphics))
            {
                var imgGraphics = Graphics.FromImage(img);
                imgGraphics.DrawImage(args.Image, new Rectangle(0, 0, args.Bounds.Width, args.Bounds.Height), args.Bounds, GraphicsUnit.Pixel);

                if (_props.Horizontal)
                {
                    if (_props.Vertical)
                    {
                        img.RotateFlip(RotateFlipType.RotateNoneFlipXY);
                    }
                    else
                    {
                        img.RotateFlip(RotateFlipType.RotateNoneFlipX);
                    }
                }
                else if (_props.Vertical)
                {
                    img.RotateFlip(RotateFlipType.RotateNoneFlipY);
                }

                args.Graphics.DrawImage(img, args.Bounds);
            }
        }
Пример #3
0
        void DrawImage(object sender, WidgetDrawArgs args)
        {
            var diameter = ScaleWithSize
                ? (int)(Diameter * Parent.Size.MaxFloat() / 140)
                : Diameter;

            if (_follow)
            {
                _position = new Point(
                    (int)args.CursorPosition.X - diameter / 2,
                    (int)args.CursorPosition.Y - diameter / 2
                    );
            }

            if (_draw_color.Current == Color.Transparent)
            {
                return;
            }

            args.SpriteBatch.Draw(
                _circle,
                new Rectangle(_position.X, _position.Y, diameter, diameter),
                _draw_color.Current
                );
        }
Пример #4
0
        void Draw(object sender, WidgetDrawArgs args)
        {
            if (!Parent.VisualSettings.DrawBackground)
            {
                return;
            }

            args.SpriteBatch.FillRectangle(
                args.DrawingArea,
                Parent.IsHighlighted
                    ? Color.Yellow
                    : Parent.VisualSettings.BackgroundColor
                );
        }
Пример #5
0
        void Draw(object sender, WidgetDrawArgs args)
        {
            if (!Parent.VisualSettings.DrawOutline)
            {
                return;
            }

            DrawingTools.DrawBorder(
                Parent._white_dot,
                args.SpriteBatch,
                args.DrawingArea.ToRectangle(),
                OutlineThickness,
                Parent.VisualSettings.OutlineColor,
                Parent.VisualSettings.OutlineSides
                );
        }
Пример #6
0
        private void WidgetLayoutControl_Paint(object sender, PaintEventArgs e)
        {
            try
            {
                var g = e.Graphics;
                g.FillRectangle(SystemBrushes.Window, e.ClipRectangle);

                var matrix = new System.Drawing.Drawing2D.Matrix();
                matrix.Translate(_displayOffset.X, _displayOffset.Y);
                matrix.Scale(_displayScale, _displayScale);
                g.Transform = matrix;

                var screenList = new ScreenList();

                foreach (var screen in screenList)
                {
                    using (var brush = GraphicsUtil.CreateRadialGradientBrush(screen.Bounds, Color.Blue, Color.Navy))
                    {
                        g.FillRectangle(brush, screen.Bounds);
                    }
                }

                foreach (var widget in _widgets)
                {
                    var args = new WidgetDrawArgs(widget.Config, widget.Bounds, g, null, true);
                    g.SetClip(widget.Bounds);
                    widget.Draw(args);
                    g.ResetClip();
                }

                foreach (var screen in screenList)
                {
                    g.DrawRectangle(SystemPens.ControlDarkDark, screen.Bounds);
                }

                g.Transform = new System.Drawing.Drawing2D.Matrix();
                DrawSelectedWidgetBorder(g);
            }
            catch (Exception ex)
            {
                this.ShowError(ex);
            }
        }
Пример #7
0
        void Draw(object sender, WidgetDrawArgs args)
        {
            //args.RestartDefault();

            // foreach (var neighbor in neighbors)
            //     args.SpriteBatch.DrawLine(cursor.Position, neighbor.Position, Color.White);

            foreach (var line in lines)
            {
                args.SpriteBatch.DrawLine(line.Key.Position.WithOffset(Offset), line.Key.Size.ToPoint2().WithOffset(Offset), Color.Lerp(Color.Transparent, LineColor, line.Value), LineThickness);
            }

            if (!DrawCircles)
            {
                return;
            }

            foreach (var circle in circles)
            {
                circle.Draw(circle_t, args);
            }
        }
Пример #8
0
        public void Draw(WidgetDrawArgs args)
        {
            var g      = args.Graphics;
            var bounds = args.Bounds;

            var headerHeight = (int)(bounds.Height / 7.0f);
            var headerRect   = new Rectangle(bounds.Left, bounds.Top, bounds.Width, headerHeight);
            var daysRect     = new Rectangle(bounds.Left, bounds.Top + headerHeight, bounds.Width, bounds.Height - headerHeight);

            if (bounds != _lastBounds)
            {
                _lastBounds = bounds;

                _backBrush           = CreateRadialGradientBrush(bounds, Color.FromArgb(0xff, 0, 0, 0), Color.FromArgb(0x40, 0, 0, 0));
                _currentDayBackBrush = CreateRadialGradientBrush(bounds, Color.FromArgb(0xff, 255, 140, 0), Color.FromArgb(0x40, 255, 140, 0));
                _borderPen           = new Pen(Color.Gray);
                _daysFont            = new Font(FontFamily.GenericSansSerif, ((float)daysRect.Height / 12.0f), FontStyle.Bold, GraphicsUnit.Pixel);
                _headerFont          = new Font(FontFamily.GenericSansSerif, headerRect.Height / 2.0f, FontStyle.Bold, GraphicsUnit.Pixel);
            }

            DrawHeader(g, headerRect);
            DrawCalendarDays(g, daysRect);
        }
Пример #9
0
        internal void Draw(WidgetDrawArgs args)
        {
            var progress = Progress.Current;

            var vert = new VertexPositionColor[StartingVertex.Length];

            for (var i = 0; i < vert.Length; i++)
            {
                vert[i] = StartingVertex[i].Lerp(EndingVertex[i], progress);
            }

            basicEffect.Projection = args.GetStretchedProjection();

            args.RestartImmediate();

            foreach (var effectPass in basicEffect.CurrentTechnique.Passes)
            {
                effectPass.Apply();
                args.GraphicsDevice.DrawUserPrimitives(
                    PrimitiveType.TriangleList, vert, 0, vert.Length / 3);
            }

            args.RestartDefault();
        }
Пример #10
0
 public void Draw(Texture2D circle, WidgetDrawArgs args) =>
 args.SpriteBatch.Draw(
     circle,
     circle_size.AsRectangleSize().WithCenter(circle_position.Position).ToRectangle(),
     Color.White
     );
Пример #11
0
        public void Draw(WidgetDrawArgs args)
        {
            _bounds = args.Bounds;
            _row    = _bounds.Top;
            _g      = args.Graphics;
            _sample = args.Sample;

            _labelFont  = new Font(FontFamily.GenericSansSerif, k_rowHeight, FontStyle.Bold, GraphicsUnit.Pixel);
            _valueFont  = new Font(FontFamily.GenericSansSerif, k_rowHeight, FontStyle.Regular, GraphicsUnit.Pixel);
            _labelBrush = new SolidBrush(_props.LabelColor);
            _valueBrush = new SolidBrush(_props.ValueColor);

            if (_props.HostName)
            {
                DrawItem("Host Name:", ValueType.HostName);
            }
            if (_props.LogonDomain)
            {
                DrawItem("Logon Domain:", ValueType.LogonDomain);
            }
            if (_props.IpAddress)
            {
                DrawItem("IP Address:", ValueType.IpAddress);
            }
            if (_props.MachineDomain)
            {
                DrawItem("Machine Domain:", ValueType.MachineDomain);
            }
            if (_props.MacAddress)
            {
                DrawItem("MAC Address:", ValueType.MacAddress);
            }
            if (_props.BootTime)
            {
                DrawItem("Boot Time:", ValueType.BootTime);
            }
            if (_props.Cpu)
            {
                DrawItem("CPU:", ValueType.CPU);
            }
            if (_props.DefaultGateway)
            {
                DrawItem("Default Gateway:", ValueType.DefaultGateway);
            }
            if (_props.DhcpServer)
            {
                DrawItem("DHCP Server:", ValueType.DhcpServer);
            }
            if (_props.DnsServer)
            {
                DrawItem("DNS Server:", ValueType.DnsServer);
            }
            if (_props.FreeSpace)
            {
                DrawItem("Free Space:", ValueType.FreeSpace);
            }

            _labelFont  = null;
            _valueFont  = null;
            _labelBrush = null;
            _valueBrush = null;
            _g          = null;
        }
Пример #12
0
        void Draw(object sender, WidgetDrawArgs args)
        {
            var draw_area = texture.Bounds.ToRectangleF().WithScaledSize(SizeModifier).WithCenter(args.DrawingArea).ToRectangle();

            Parent.SpriteBatch.Draw(texture, draw_area, Color.White);
        }
Пример #13
0
 void Draw(object sender, WidgetDrawArgs args)
 {
 }
Пример #14
0
 public void Draw(WidgetDrawArgs args)
 {
     _widget.Draw(args);
 }