DrawBoxBordered() public static method

Draws a bordered Box
public static DrawBoxBordered ( float x, float y, float w, float h, float borderWidth, Color color, Color colorBorder ) : void
x float Position X
y float Position Y
w float Width
h float Height
borderWidth float The border width
color Color Color
colorBorder Color Border Color
return void
Beispiel #1
0
        /// <summary>
        ///     The draw on off.
        /// </summary>
        /// <param name="on">
        ///     The on.
        /// </param>
        /// <param name="position">
        ///     The position.
        /// </param>
        /// <param name="item">
        ///     The item.
        /// </param>
        internal static void DrawOnOff(bool on, Vector2 position, MenuItem item)
        {
            var alpha = Utils.IsUnderRectangle(
                Game.MouseScreenPosition,
                position.X + item.Height - item.Width,
                position.Y,
                item.Width,
                item.Height)
                            ? 30
                            : 0;
            var alpha2 = Utils.IsUnderRectangle(
                Game.MouseScreenPosition,
                position.X,
                position.Y,
                item.Height,
                item.Height)
                             ? 25
                             : 0;
            var noUnicode = MenuConfig.SelectedLanguage == "Chinese" || MenuConfig.SelectedLanguage == "Russian";
            var s         = on ? "✔" : string.Empty;
            var pos       = position + new Vector2(item.Height / 6, item.Height / 6);
            var height    = item.Height - item.Height / 6 * 2;

            MenuUtils.DrawBoxBordered(
                pos.X,
                pos.Y,
                height,
                height,
                1f,
                Color.FromArgb(140 + alpha, 90 + alpha, 1 + alpha).ToSharpDxColor(),
                new SharpDX.Color(0, 0, 0));

            Drawing.DrawRect(
                pos + new Vector2(height / 10, height / 10),
                new Vector2((float)(height - height / 10 * 2), (float)(height - height / 10 * 2) - 1),
                new SharpDX.Color(5 + alpha2, 5 + alpha2, 5 + alpha2));
            if (noUnicode)
            {
                if (!on)
                {
                    return;
                }

                Drawing.DrawRect(
                    pos + new Vector2(height / 4, height / 4),
                    new Vector2((float)(height - height / 4 * 2), (float)(height - height / 4 * 2) - 1),
                    new SharpDX.Color(230, 148, 2));
            }
            else
            {
                var tsize    = new Vector2((float)(height / 1.1), item.Width);
                var textSize = Drawing.MeasureText(s, "Arial", tsize, FontFlags.AntiAlias);
                var textPos  = item.Position
                               + new Vector2(
                    (float)(item.Width - item.Height / 2 - textSize.X / 2.9),
                    (float)(+(item.Height * 0.5) - textSize.Y / 1.9));

                Drawing.DrawText(s, textPos, tsize, Color.NavajoWhite.ToSharpDxColor(), FontFlags.Italic);
            }
        }