public override void DrawToFrameBuffer(double gameTime)
{
base.DrawToFrameBuffer(gameTime);
int size = clientRectangle.Height;
if (size < 5) return;
RectangleF fontSize = frameMgr.textPrinter.Measure("0", Font).BoundingBox;
Rectangle screenRectClient = ClientToScreen(clientRectangle);
screenRectText = new Rectangle(screenRectClient.X, screenRectClient.Y, clientRectangle.Width - size, clientRectangle.Height);
screenRectButton = new Rectangle(screenRectClient.Right - size, screenRectClient.Y, size, size);
object[] items = Items;
Rectangle[] itemRects = new Rectangle[items.Length];
for (int i = 0; i < items.Length; i++)
{
itemRects[i] = new Rectangle(screenRectClient.X, screenRectClient.Bottom + ((int)fontSize.Height * i) + 1, screenRectClient.Width, (int)fontSize.Height);
}
screenRectDropListItems = itemRects;
Rectangle frameRectText = ScreenToFrame(screenRectText);
Rectangle frameRectButton = ScreenToFrame(screenRectButton);
List<PositionColor> verts = new List<PositionColor>();
verts.Add(new PositionColor(new Vector3(frameRectButton.Left, frameRectButton.Top, 0f), Gradient(Color.Gray, 255)));
verts.Add(new PositionColor(new Vector3(frameRectButton.Left, frameRectButton.Bottom, 0f), Gradient(Color.Gray, 127)));
verts.Add(new PositionColor(new Vector3(frameRectButton.Right, frameRectButton.Top, 0f), Gradient(Color.Gray, 127)));
verts.Add(new PositionColor(new Vector3(frameRectButton.Left, frameRectButton.Bottom, 0f), Gradient(Color.Gray, 127)));
verts.Add(new PositionColor(new Vector3(frameRectButton.Right, frameRectButton.Bottom, 0f), Gradient(Color.Gray, 0)));
verts.Add(new PositionColor(new Vector3(frameRectButton.Right, frameRectButton.Top, 0f), Gradient(Color.Gray, 127)));
verts.Add(new PositionColor(new Vector3(frameRectButton.Left + 2, frameRectButton.Top + 2, 0f), Gradient(Color.LightGray, 255)));
verts.Add(new PositionColor(new Vector3(frameRectButton.Left + (size / 2), frameRectButton.Bottom - 2, 0f), Gradient(Color.LightGray, 100)));
verts.Add(new PositionColor(new Vector3(frameRectButton.Right - 2, frameRectButton.Top + 2, 0f), Gradient(Color.LightGray, 127)));
if (showDropList)
{
for (int i = 0; i < items.Length; i++)
{
Rectangle frameRectDropListItem = ScreenToFrame(screenRectDropListItems[i]);
verts.Add(new PositionColor(new Vector3(frameRectDropListItem.Left, frameRectDropListItem.Top, 0f), Color.Gray));
verts.Add(new PositionColor(new Vector3(frameRectDropListItem.Left, frameRectDropListItem.Bottom, 0f), Color.Gray));
verts.Add(new PositionColor(new Vector3(frameRectDropListItem.Right, frameRectDropListItem.Top, 0f), Color.Gray));
verts.Add(new PositionColor(new Vector3(frameRectDropListItem.Left, frameRectDropListItem.Bottom, 0f), Color.Gray));
verts.Add(new PositionColor(new Vector3(frameRectDropListItem.Right, frameRectDropListItem.Bottom, 0f), Color.Gray));
verts.Add(new PositionColor(new Vector3(frameRectDropListItem.Right, frameRectDropListItem.Top, 0f), Color.Gray));
}
}
PositionColor.Draw(BeginMode.Triangles, verts.ToArray());
Frame.DrawText(Font, Text, frameRectText, DrawTextFormat.Bottom | DrawTextFormat.WordBreak, Color.Black);
if (showDropList)
{
for (int i = 0; i < items.Length; i++)
{
Rectangle frameRectDropListItem = ScreenToFrame(screenRectDropListItems[i]);
Frame.DrawText(Font, items[i].ToString(), frameRectDropListItem, DrawTextFormat.Left | DrawTextFormat.Bottom, Color.Black);
}
}
}