public static GetElementImage ( string element ) : Image | ||
element | string | |
Результат | Image |
private void AddResistances(List <Resistance> resistances) { List <Resistance> sorted_list = resistances.OrderByDescending(o => o.resistance).ToList(); int i = 0; foreach (Resistance resistance in sorted_list) { resistance_tooltip.SetToolTip(resistance_controls[i], "Damage taken from " + resistance.name + ": " + resistance.resistance.ToString() + "%"); // add a tooltip that displays the actual resistance when you mouseover Bitmap bitmap = new Bitmap(19 + resistance.resistance, 19); Graphics gr = Graphics.FromImage(bitmap); using (Brush brush = new SolidBrush(StyleManager.GetElementColor(resistance.name))) { gr.FillRectangle(brush, new Rectangle(19, 0, bitmap.Width - 19, bitmap.Height)); } gr.DrawRectangle(Pens.Black, new Rectangle(19, 0, bitmap.Width - 20, bitmap.Height - 1)); Image image = StyleManager.GetElementImage(resistance.name); lock (image) { gr.DrawImage(image, new Point(2, 2)); } resistance_controls[i].Width = bitmap.Width; resistance_controls[i].Height = bitmap.Height; resistance_controls[i].Image = bitmap; i++; } }