Пример #1
0
 public void Draw(SpriteBatch s, Point initialLocation)
 {
     s.Draw(Texture, new Rectangle(Location.X + initialLocation.X, Location.Y + initialLocation.Y, Size.Width, Size.Height), BackColor.ToXnaColor());
     s.DrawString(Font, Text, new Vector2(initialLocation.X + Location.X, initialLocation.Y + Location.Y), ForeColor.ToXnaColor());
 }
Пример #2
0
        protected void Draw(SpriteBatch s, Point initialLocation, string text)
        {
            s.Draw(Texture, new Rectangle(Location.X + initialLocation.X, Location.Y + initialLocation.Y, Size.Width, Size.Height), BackColor.ToXnaColor());

            var drawText = text;

            if (!string.IsNullOrEmpty(Text))
            {
                if (ContainsFocus && DateTime.UtcNow.Millisecond / 500 == 0)
                {
                    drawText += "|";
                }

                s.DrawString(Font, drawText, new Vector2(initialLocation.X + Location.X, initialLocation.Y + Location.Y), ForeColor.ToXnaColor());
            }
            else
            {
                drawText = TextPlaceholder;
                s.DrawString(Font, drawText, new Vector2(initialLocation.X + Location.X, initialLocation.Y + Location.Y), ForeColorPlaceholder.ToXnaColor());

                if (ContainsFocus && DateTime.UtcNow.Millisecond / 500 == 0)
                {
                    s.DrawString(Font, "|", new Vector2(initialLocation.X + Location.X, initialLocation.Y + Location.Y), ForeColor.ToXnaColor());
                }
            }
        }
Пример #3
0
        private void Draw(SpriteBatch s)
        {
            if (Visible && Enabled)
            {
                if (ShowTitleBar)
                {
                    s.Draw(TitleTexture, new Rectangle(Location.X, Location.Y, Size.Width, TitleBarHeight), TitleBarColor.ToXnaColor());
                    s.Draw(BackgroundTexture, new Rectangle(Location.X, Location.Y + TitleBarHeight, Size.Width, Size.Height - TitleBarHeight), BackColor.ToXnaColor());
                }
                else
                {
                    s.Draw(BackgroundTexture, new Rectangle(Location.X, Location.Y, Size.Width, Size.Height), BackColor.ToXnaColor());
                }

                foreach (var c in Controls)
                {
                    var drawableControl = c as IDrawableControl;

                    if (drawableControl == null)
                    {
                        continue;
                    }

                    if (ShowTitleBar)
                    {
                        drawableControl.Draw(s, new EFD.Point(Location.X, Location.Y + TitleBarHeight));
                    }
                    else
                    {
                        drawableControl.Draw(s, Location);
                    }
                }
            }
        }