public Image CreatureBox(Creature creature, int amount = 0) { Bitmap bitmap = new Bitmap(BlockWidth, BlockHeight); using (Graphics gr = Graphics.FromImage(bitmap)) { Color backColor = StyleManager.GetElementColor(creature.GetStrength()); using (Brush brush = new SolidBrush(backColor)) { gr.FillRectangle(brush, new Rectangle(0, 0, bitmap.Width, bitmap.Height)); } gr.DrawRectangle(Pens.Black, new Rectangle(0, 0, bitmap.Width - 1, bitmap.Height - 1)); RenderImageResized(gr, StyleManager.GetImage("item_background.png"), new Rectangle(1, 1, BlockHeight - 2, BlockHeight - 2)); RenderImageResized(gr, creature.GetImage(), new Rectangle(1, 1, BlockHeight - 2, BlockHeight - 2)); RenderText(gr, creature.displayname.ToTitle(), BlockHeight + 2, Color.Empty, StyleManager.NotificationTextColor, Color.Black, BlockHeight); if (amount > 0) { RenderText(gr, amount.ToString(), -BlockWidth, Color.FromArgb(backColor.R / 2, backColor.G / 2, backColor.B / 2), StyleManager.NotificationTextColor, Color.Black, BlockHeight); } } return(bitmap); }
public Image CreatureBox(Creature creature, int amount = 0) { Bitmap bitmap = new Bitmap(BlockWidth, BlockHeight); using (Graphics gr = Graphics.FromImage(bitmap)) { Color backColor = StyleManager.GetElementColor(creature.GetStrength()); using (Brush brush = new SolidBrush(backColor)) { gr.FillRectangle(brush, new Rectangle(0, 0, bitmap.Width, bitmap.Height)); } gr.DrawRectangle(Pens.Black, new Rectangle(0, 0, bitmap.Width - 1, bitmap.Height - 1)); RenderImageResized(gr, StyleManager.GetImage("item_background.png"), new Rectangle(1, 1, BlockHeight - 2, BlockHeight - 2)); RenderImageResized(gr, creature.GetImage(), new Rectangle(1, 1, BlockHeight - 2, BlockHeight - 2)); RenderText(gr, creature.displayname.ToTitle(), BlockHeight + 2, Color.Empty, StyleManager.NotificationTextColor, Color.Black, BlockHeight); if (amount > 0) { RenderText(gr, amount.ToString(), -BlockWidth, Color.FromArgb(backColor.R / 2, backColor.G / 2, backColor.B / 2), StyleManager.NotificationTextColor, Color.Black, BlockHeight); } } return bitmap; }