public override void Draw() { MouseOverIndex = -1; Color outerBorderColor = Skin.OuterBorderColor; Color innerBorderColor = Skin.InnerBorderColor; Color innerButtonColor = Skin.WhiteBackgroundColor; Color textColor = Skin.TextColor; Primitives.FillRectangle(Rectangle, innerBorderColor); Primitives.DrawRectangle(Rectangle, outerBorderColor, Skin.OuterBorderThickness); Primitives.DrawAndFillRectangle(InnerRectangleWithBorder, innerButtonColor, outerBorderColor, Skin.OuterBorderThickness); // Primitives.DrawMultiLineText(txt + (Root.SecondsSinceStartInt % 2 == 0 ? "|" : ""), new Rectangle(InnerRectangle.X + 8, InnerRectangle.Y + 3, InnerRectangle.Width - 10, InnerRectangle.Height - 4), textColor, Skin.Font, Primitives.TextAlignment.TopLeft); for (int i = _topOfList; i < Items.Count; i++) { Rectangle rectItem = new Rectangle(InnerRectangle.X + 1, InnerRectangle.Y + Skin.ListItemHeight * (i - _topOfList) + 1, InnerRectangle.Width - 2, Skin.ListItemHeight); if (Root.IsMouseOver(rectItem)) { MouseOverIndex = i; } if (_selectedIndex == i) { Primitives.FillRectangle(rectItem, Skin.ItemSelectedBackgroundColor); } else if (MouseOverIndex == i) { Primitives.FillRectangle(rectItem, Skin.ItemMouseOverBackgroundColor); } Primitives.DrawSingleLineText(Items[i].ToString(), new Vector2(InnerRectangle.X + 5, InnerRectangle.Y + 2 + Skin.ListItemHeight * (i - _topOfList)), Skin.TextColor, Skin.Font); Primitives.DrawLine(new Vector2(InnerRectangle.X, InnerRectangle.Y + Skin.ListItemHeight * (i - _topOfList + 1)), new Vector2(InnerRectangle.Right, InnerRectangle.Y + Skin.ListItemHeight * (i - _topOfList + 1)), outerBorderColor, Skin.OuterBorderThickness); } }
public override void Draw() { IsMouseOverThis = Root.IsMouseOver(Rectangle); bool pressed = IsMouseOverThis && Root.Mouse_NewState.LeftButton == ButtonState.Pressed; Color outerBorderColor = IsMouseOverThis ? Skin.OuterBorderColorMouseOver : Skin.OuterBorderColor; Color innerBorderColor = pressed ? Skin.InnerBorderColorMousePressed : (IsMouseOverThis ? Skin.InnerBorderColorMouseOver : Skin.InnerBorderColor); Color innerButtonColor = IsMouseOverThis ? Skin.GreyBackgroundColorMouseOver: Skin.GreyBackgroundColor; Color textColor = IsMouseOverThis ? Skin.TextColorMouseOver : Skin.TextColor; Primitives.FillRectangle(Rectangle, innerBorderColor); Primitives.DrawRectangle(Rectangle, outerBorderColor, Skin.OuterBorderThickness); Primitives.DrawAndFillRectangle(InnerRectangleWithBorder, innerButtonColor, outerBorderColor, Skin.OuterBorderThickness); Primitives.DrawMultiLineText(Caption, InnerRectangle, textColor, Skin.Font, Primitives.TextAlignment.Middle); }
public override void Draw(SpriteBatch sb, Game game, float elapsedSeconds) { Rectangle rectBox = new Rectangle(TopLeftX, TopLeftY, Width, Height); Rectangle rectTitle = new Rectangle(TopLeftX, TopLeftY, Width, 28); Primitives.DrawAndFillRectangle(rectBox, Skin.DialogBackgroundColor, Skin.OuterBorderColor, Skin.OuterBorderThickness); Primitives.DrawAndFillRectangle(rectTitle, Skin.InnerBorderColor, Skin.OuterBorderColor, Skin.OuterBorderThickness); Primitives.DrawSingleLineText(Caption, new Vector2(TopLeftX + 5, TopLeftY + 3), Skin.TextColor, Skin.Font); if (Icon != GUIIcon.None) { sb.Draw(Library.GetTexture2DFromGUIIcon(Icon), new Rectangle(rectBox.X + 5, rectBox.Y + 60, 45, 45), Color.White); } Primitives.DrawMultiLineText(Text, new Rectangle(rectBox.X + 55, rectBox.Y + 50, rectBox.Width - 65, rectBox.Height - 40), Skin.TextColor, Skin.Font, Primitives.TextAlignment.Top); foreach (Button b in Buttons) { b.Draw(); } base.Draw(sb, game, elapsedSeconds); }