public override void Draw(GameTime gameTime, SpriteBatch sb) { base.Draw(gameTime, sb); float _width = Size.X / Cols; for (int _index = 1; _index < Cols; _index++) { GGraphics.DrawLine( ActualPosition.ToPoint() + new Point((int)_width * _index, 0), (int)Size.Y, 2, false, Color.White, Depth - StringBorderDepthAdd, sb ); } float _height = Size.Y / Rows; for (int _index = 1; _index < Rows; _index++) { GGraphics.DrawLine( ActualPosition.ToPoint() + new Point(0, (int)_height * _index), (int)Size.X, 2, true, Color.White, Depth - StringBorderDepthAdd, sb ); } }
public virtual void Draw(GameTime gameTime, SpriteBatch sb) { if (!Focused || FocusBgc == null) { if (Bgc != null) { GGraphics.FillRectangle( Bounds, Hovering ? HoverBgc ?? Bgc.Value : Bgc.Value, Depth, sb ); } } else if (Focused && FocusBgc != null) { if (FocusBgc != null) { GGraphics.FillRectangle( Bounds, Hovering ? FocusHoverBgc ?? FocusBgc.Value : FocusBgc.Value, Depth, sb ); } } if (BorderColor != null) { GGraphics.DrawRectangle( Bounds, BorderColor.Value, BorderThickness, Depth - StringBorderDepthAdd, sb ); } foreach (var _item in Items) { _item.Draw(gameTime, sb); } // Show type if (ShowType && !string.IsNullOrWhiteSpace(Type)) { Vector2 _pos = ActualPosition; Vector2 _tSize = GContent.MenuFont.MeasureString(Type); Vector2 _tPos = _pos; _tPos.X += Size.X / 2 - _tSize.X / 2; _tPos.Y += Size.Y / 2 - _tSize.Y / 2; sb.DrawString( GContent.MenuFont, Type, _tPos, Color.White, 0, Vector2.Zero, 1.0f, SpriteEffects.None, Depth - StringBorderDepthAdd ); } // Show text if (ShowText) { if (!string.IsNullOrWhiteSpace(Text)) { Vector2 _pos = ActualPosition; Vector2 _tSize = GContent.MenuFont.MeasureString(Text); Vector2 _tPos = _pos; switch (TextHAlign) { case MenuHAlign.Left: break; case MenuHAlign.Right: _tPos.X += ActualSize.X - _tSize.X; break; case MenuHAlign.Center: _tPos.X += Size.X / 2 - _tSize.X / 2; break; } switch (TextVAlign) { case MenuVAlign.Top: break; case MenuVAlign.Bottom: _tPos.Y += ActualSize.Y - _tSize.Y; break; case MenuVAlign.Middle: _tPos.Y += Size.Y / 2 - _tSize.Y / 2; break; } sb.DrawString( GContent.MenuFont, Text, _tPos, Color.White, 0f, Vector2.Zero, 1, SpriteEffects.None, Depth - StringBorderDepthAdd ); } } }