public override void Draw(GUIGraphicEngine guiGraphicEngine) { Rectangle rect = new Rectangle(new Point(0, 0), Size); guiGraphicEngine.DrawRectangle(rect, ButtonColor); Size textSize = guiGraphicEngine.GetTextSizePixels(text); Point textPosition = new Point(1, 1); if (textSize.Width < Size.Width) { textPosition.X = (Size.Width - textSize.Width) / 2; } if (textSize.Height < Size.Height) { textPosition.Y = Size.Height / 2 - textSize.Height + 3; } guiGraphicEngine.DrawText(textPosition, Text, TextColor); guiGraphicEngine.DrawRectangleFrame(rect, FrameColor, 1); if (Father.Focus == this) { guiGraphicEngine.DrawRectangleFrame(rect, Color.White, 1); } }
public override void Draw(GUIGraphicEngine guiGraphicEngine) { Rectangle rect = new Rectangle(GUI_DIALOG_BORDER_SIZE, GUI_DIALOG_BORDER_SIZE, Size.Width - GUI_DIALOG_BORDER_SIZE * 2, GUI_DIALOG_TITLE_SIZE); //Dibujar titulo guiGraphicEngine.DrawRectangle(rect, TitleColor); int altoLetras = guiGraphicEngine.GetTextSizePixels("A").Height; guiGraphicEngine.DrawText(new Point(GUI_DIALOG_BORDER_SIZE + 4, GUI_DIALOG_TITLE_SIZE / 2 - altoLetras + 3 + GUI_DIALOG_BORDER_SIZE), title); //Dibujar cuerpo rect.Y += GUI_DIALOG_TITLE_SIZE - 1; rect.Height = Size.Height - rect.Y - GUI_DIALOG_BORDER_SIZE; guiGraphicEngine.DrawRectangle(rect, BackColor); rect.Location = new Point(0, 0); rect.Size = Size; guiGraphicEngine.DrawRectangleFrame(rect, FrameColor, GUI_DIALOG_BORDER_SIZE); }
public override void Draw(GUIGraphicEngine guiGraphicEngine) { Rectangle rect = new Rectangle(new Point(0, 0), Size); if (textChanged) { textChanged = false; Size textSize = guiGraphicEngine.GetTextSizePixels(text); if (autoFit) { Size = textSize; rect = new Rectangle(new Point(0, 0), Size); } else { if (centerHorizontally) { drawPosition.X = (Size.Width - textSize.Width) / 2; } if (centerVertically) { drawPosition.Y = Size.Height / 2 - textSize.Height; } } } if (BackColor.A > 0) { guiGraphicEngine.DrawRectangle(rect, BackColor); } guiGraphicEngine.DrawText(drawPosition, Text, TextColor); }