예제 #1
0
        /// <summary>
        /// Drawing main
        /// </summary>
        /// <param name="dp"></param>
        public override void Draw(DrawProperty dp)
        {
            var lpos = GetLayoutPos();
            var sc   = ScreenPos.From(dp.Pane, lpos);
            var lsiz = LayoutSize.From(PositionerX(CodeX <Distance> .From(Width), null), PositionerY(null, CodeY <Distance> .From(Height)));
            var ssiz = ScreenSize.From(dp.Pane, lsiz);
            var sr   = ScreenRect.FromCWH(sc, ssiz.Width, ssiz.Height);

            if (IsSelected)
            {
                // draw the requested position indicator (on the inscribed square in the circle)
                var A      = GetAngle(lpos);
                var lposIn = GetLayoutPos(A);
                var scIn   = ScreenPos.From(dp.Pane, lposIn);
                var srIn   = ScreenRect.FromCWH(scIn, ssiz.Width, ssiz.Height);
                dp.Graphics.DrawLine(_(scIn), _(sc), ConnectingColor);
                if (Design == Designs.IN)
                {
                    dp.Graphics.FillRectangle(_(srIn), Colors.DarkGray);
                }
                else
                {
                    dp.Graphics.DrawRectangle(_(srIn), Colors.DarkGray);
                }

                // draw selected color
                dp.Graphics.DrawRectangle(_(sr), SelectingColor, 4f);
                dp.Graphics.FillRectangle(_(sr), SelectingColor);
            }
            if (Design == Designs.IN)
            {
                dp.Graphics.FillRectangle(_(sr), GetColor(dp));
            }
            else
            {
                dp.Graphics.DrawRectangle(_(sr), GetColor(dp));
            }

            SelectableSize = sr.ToSize();
        }
예제 #2
0
        /// <summary>
        /// Drawing main
        /// </summary>
        /// <param name="dp"></param>
        public override void Draw(DrawProperty dp)
        {
            var sc   = GetScreenPos(dp.Pane);
            var lsiz = LayoutSize.From(PositionerX(CodeX <Distance> .From(Width), null), PositionerY(null, CodeY <Distance> .From(Height)));
            var ssiz = ScreenSize.From(dp.Pane, lsiz);
            var sr   = ScreenRect.FromCWH(sc, ssiz.Width, ssiz.Height);

            SelectableSize = sr.ToSize();

            dp.Graphics.DrawRectangle(_(sr), GetColor(dp));

            if (IsConnecting)
            {
                dp.Graphics.DrawRectangle(_(sr), ConnectingColor, 4f);
                return;
            }
            if (IsSelected)
            {
                dp.Graphics.DrawRectangle(_(sr), SelectingColor, 4f);
                return;
            }
        }