public override void Draw(SharpDXRenderer renderer)
        {
            base.Draw(renderer);
            Vector2 location = this.GetAbsoluteLocation();
            float length = (this.Radius + this.Spread * this.SpreadScale) * 2f;
            Vector2 size = new Vector2(length, length);

            if (this.Outline)
                renderer.DrawEllipse(this.SecondaryColor, location, size, true, this.Width + 2f);
            renderer.DrawEllipse(this.PrimaryColor, location, size, true, this.Width);
        }
        public override void Draw(SharpDXRenderer renderer)
        {
            base.Draw(renderer);
            Vector2 location = this.GetAbsoluteLocation();
            float   length   = (this.Radius + this.Spread * this.SpreadScale) * 2f;
            Vector2 size     = new Vector2(length, length);

            if (this.Outline)
            {
                renderer.DrawEllipse(this.SecondaryColor, location, size, true, this.Width + 2f);
            }
            renderer.DrawEllipse(this.PrimaryColor, location, size, true, this.Width);
        }
示例#3
0
        public override void Draw(SharpDXRenderer renderer)
        {
            base.Draw(renderer);
            Vector2 location = this.GetAbsoluteLocation();
            float   distance = this.Width / 2f + this.Spread * this.SpreadScale;

            switch (Type)
            {
            case Types.Default:
                for (int i = 0; i < 4; i++)
                {
                    DrawLine(renderer, location, distance, this.Radius, i * 90f, this.Width, this.Outline);
                }
                break;

            case Types.DefaultTilted:
                for (int i = 0; i < 4; i++)
                {
                    DrawLine(renderer, location, distance, this.Radius, i * 90f + 45f, this.Width, this.Outline);
                }
                break;

            case Types.Rectangle:
                for (int i = 0; i < 4; i++)
                {
                    DrawCrossLine(renderer, location, distance, this.Radius, i * 90f + 45f, this.Width, this.Outline);
                }
                break;

            case Types.RectangleTilted:
                for (int i = 0; i < 4; i++)
                {
                    DrawCrossLine(renderer, location, distance, this.Radius, i * 90f, this.Width, this.Outline);
                }
                break;

            case Types.Circle:
                float   length = (this.Radius + this.Spread * this.SpreadScale) * 2f;
                Vector2 size   = new Vector2(length, length);

                if (this.Outline)
                {
                    renderer.DrawEllipse(this.SecondaryColor, location, size, true, this.Width + 2f);
                }
                renderer.DrawEllipse(this.PrimaryColor, location, size, true, this.Width);
                break;
            }
        }
        public override void Draw(SharpDXRenderer renderer)
        {
            base.Draw(renderer);
            float fontSize = (float)Math.Ceiling(this.Font.FontSize);
            Vector2 size = renderer.MeasureString(this.Text, this.Font);
            if (!this.FillParent)
                this.Width = size.X + fontSize;
            this.Height = size.Y;
            Vector2 location = this.GetAbsoluteLocation();
            Vector2 box = new Vector2(fontSize, fontSize);
            Vector2 boxLocation = new Vector2(location.X, location.Y + this.Height / 2f - box.Y / 2f);
            if (this.MouseOver)
                renderer.FillRectangle(this.BackColor,
                    new Vector2(location.X - MarginLeft, location.Y - MarginTop),
                    new Vector2(this.Width + MarginLeft + MarginRight, this.Height + MarginTop + MarginBottom));

            renderer.DrawEllipse(this.ForeColor, boxLocation, box);

            if (this.Checked)
                renderer.FillEllipse(this.ForeColor, boxLocation + Vector2.One * 2, box - Vector2.One * 4);

            renderer.DrawText(this.Text,
                this.ForeColor,
                this.Font,
                new Vector2(location.X + box.X + MarginLeft, location.Y));
        }
        public override void Draw(SharpDXRenderer renderer)
        {
            base.Draw(renderer);
            float   fontSize = (float)Math.Ceiling(this.Font.FontSize);
            Vector2 size     = renderer.MeasureString(this.Text, this.Font);

            if (!this.FillParent)
            {
                this.Width = size.X + fontSize;
            }
            this.Height = size.Y;
            Vector2 location    = this.GetAbsoluteLocation();
            Vector2 box         = new Vector2(fontSize, fontSize);
            Vector2 boxLocation = new Vector2(location.X, location.Y + this.Height / 2f - box.Y / 2f);

            if (this.MouseOver)
            {
                renderer.FillRectangle(this.BackColor,
                                       new Vector2(location.X - MarginLeft, location.Y - MarginTop),
                                       new Vector2(this.Width + MarginLeft + MarginRight, this.Height + MarginTop + MarginBottom));
            }

            renderer.DrawEllipse(this.ForeColor, boxLocation, box);

            if (this.Checked)
            {
                renderer.FillEllipse(this.ForeColor, boxLocation + Vector2.One * 2, box - Vector2.One * 4);
            }

            renderer.DrawText(this.Text,
                              this.ForeColor,
                              this.Font,
                              new Vector2(location.X + box.X + MarginLeft, location.Y));
        }
        protected virtual void DrawDot(SharpDXRenderer renderer, Vector2 coordinate, Color color, Vector2 controlCenter, Vector2 dotSize)
        {
            Vector2 delta = (coordinate - CenterCoordinate) * Scaling;

            delta.X *= -1;
            if (Rotating)
            {
                delta = SharpDXConverter.Vector2EUCtoSDX(
                    MathUtils.RotatePoint(
                        SharpDXConverter.Vector2SDXtoEUC(delta),
                        ExternalUtilsCSharp.MathObjects.Vector2.Zero,
                        RotationDegrees));
            }
            if (Math.Abs(delta.X) + DotRadius > this.Width / 2f)
            {
                if (delta.X > 0)
                {
                    delta.X = this.Width / 2f - DotRadius;
                }
                else
                {
                    delta.X = -this.Width / 2f + DotRadius;
                }
            }
            if (Math.Abs(delta.Y) + DotRadius > this.Height / 2f)
            {
                if (delta.Y > 0)
                {
                    delta.Y = this.Height / 2f - DotRadius;
                }
                else
                {
                    delta.Y = -this.Height / 2f + DotRadius;
                }
            }

            renderer.FillEllipse(color, controlCenter + delta, dotSize, true);
            renderer.DrawEllipse(this.ForeColor, controlCenter + delta, dotSize, true);
        }
        public override void Draw(SharpDXRenderer renderer)
        {
            base.Draw(renderer);
            Vector2 location = this.GetAbsoluteLocation();
            float distance = this.Width / 2f + this.Spread * this.SpreadScale;

            switch (Type)
            {
                case Types.Default:
                    for (int i = 0; i < 4; i++)
                        DrawLine(renderer, location, distance, this.Radius, i * 90f, this.Width, this.Outline);
                    break;
                case Types.DefaultTilted:
                    for (int i = 0; i < 4; i++)
                        DrawLine(renderer, location, distance, this.Radius, i * 90f + 45f, this.Width, this.Outline);
                    break;
                case Types.Rectangle:
                    for (int i = 0; i < 4; i++)
                        DrawCrossLine(renderer, location, distance, this.Radius, i * 90f + 45f, this.Width, this.Outline);
                    break;
                case Types.RectangleTilted:
                    for (int i = 0; i < 4; i++)
                        DrawCrossLine(renderer, location, distance, this.Radius, i * 90f, this.Width, this.Outline);
                    break;
                case Types.Circle:
                    float length = (this.Radius + this.Spread * this.SpreadScale) * 2f;
                    Vector2 size = new Vector2(length, length);

                    if (this.Outline)
                        renderer.DrawEllipse(this.SecondaryColor, location, size, true, this.Width + 2f);
                    renderer.DrawEllipse(this.PrimaryColor, location, size, true, this.Width);
                    break;
            }
        }
        protected virtual void DrawDot(SharpDXRenderer renderer, Vector2 coordinate, Color color, Vector2 controlCenter, Vector2 dotSize)
        {
            Vector2 delta = (coordinate - CenterCoordinate) * Scaling;
            delta.X *= -1;
            if (Rotating)
            {
                delta = SharpDXConverter.Vector2EUCtoSDX(
                            MathUtils.RotatePoint(
                                SharpDXConverter.Vector2SDXtoEUC(delta),
                                ExternalUtilsCSharp.MathObjects.Vector2.Zero,
                                RotationDegrees));
            }
            if (Math.Abs(delta.X) + DotRadius > this.Width / 2f)
                if (delta.X > 0)
                    delta.X = this.Width / 2f - DotRadius;
                else
                    delta.X = -this.Width / 2f + DotRadius;
            if (Math.Abs(delta.Y) + DotRadius > this.Height / 2f)
                if (delta.Y > 0)
                    delta.Y = this.Height / 2f - DotRadius;
                else
                    delta.Y = -this.Height / 2f + DotRadius;

            renderer.FillEllipse(color, controlCenter + delta, dotSize, true);
            renderer.DrawEllipse(this.ForeColor, controlCenter + delta, dotSize, true);
        }