private void cbSpellFilter_DrawItem(object sender, DrawItemEventArgs e) { if (Heroes3Master.Master != null && e.Index >= 0 && selectedFilterIndex >= 0) { Color clr; Bitmap schoolImage; if (e.Index == 0) { clr = Color.Lavender; schoolImage = new Bitmap(SecondarySkill.GetImage(Heroes3Master.Master, 25, 3), 32, 32); //25 is sorecery //schoolImage = SecondarySkill.GetImage(Heroes3Master.Master.H3Sprite, 25, 3); //25 is sorecery } else { clr = Spell.MagicSchoolColors[e.Index - 1]; schoolImage = new Bitmap(SecondarySkill.GetImage(Heroes3Master.Master, SecondarySkill.MagicSchoolSecondarySkillIndexes[e.Index - 1], 3), 32, 32); // schoolImage = SecondarySkill.GetImage(Heroes3Master.Master.H3Sprite, SecondarySkill.MagicSchoolSecondarySkillIndexes[e.Index - 1], 3); } e.Graphics.FillRectangle(new SolidBrush(clr), e.Bounds); e.Graphics.DrawImage(schoolImage, e.Bounds.X, e.Bounds.Y); e.Graphics.DrawString(cbSpellFilter.Items[e.Index].ToString(), e.Font, Brushes.Black, e.Bounds.X + 56, e.Bounds.Y + 9); } }
// private static Bitmap GetImageForPropertyType(ProfilePropertyType propertyType, int index, bool forceAllCreatures) { if (index >= 0) { if (propertyType == ProfilePropertyType.Creature) { int realIndex = CreatureManager.OnlyActiveCreatures[index].CreatureIndex; return(CreatureManager.GetImage(Heroes3Master.Master, realIndex)); } if (propertyType == ProfilePropertyType.SecondarySkill) { return(SecondarySkill.AllSkills[index / 3].GetImage(Heroes3Master.Master, 1 + index % 3)); } if (propertyType == ProfilePropertyType.Spell) { return(Spell.AllSpells[index].GetImage(Heroes3Master.Master)); } if (propertyType == ProfilePropertyType.SpecCreature || propertyType == ProfilePropertyType.SpecCreatureStatic) { return(CreatureManager.GetImage(Heroes3Master.Master, CreatureManager.IndexesOfFirstLevelCreatures[index])); } if (propertyType == ProfilePropertyType.SpecCreatureUpgrade) { if (!forceAllCreatures) { return(CreatureManager.GetImage(Heroes3Master.Master, CreatureManager.IndexesOfFirstLevelCreatures[index])); } int realIndex = CreatureManager.OnlyActiveCreatures[index].CreatureIndex; return(CreatureManager.GetImage(Heroes3Master.Master, realIndex)); } if (propertyType == ProfilePropertyType.SpecSpell) { return(Spell.GetSpellByIndex(Spell.SpecSpellIndexes[index]).GetImage(Heroes3Master.Master)); } if (propertyType == ProfilePropertyType.SpecSecondarySkill) { return(SecondarySkill.GetImage(Heroes3Master.Master, SecondarySkill.IndexesOfAllSpecSkills[index], 1)); } if (propertyType == ProfilePropertyType.SpecResource) { return(Resource.GetImage(Heroes3Master.Master, index)); } } return(null); }
private void TryLoadStaticImages() { if (BitmapCache.SpellsMagicSchools == null || BitmapCache.SpellsMagicSchoolsInactive == null) { BitmapCache.SpellsMagicSchools = new Bitmap[5]; BitmapCache.SpellsMagicSchoolsInactive = new Bitmap[4]; for (int i = 0; i < 4; i++) { BitmapCache.SpellsMagicSchools[i] = SecondarySkill.GetImage(Heroes3Master.Master, SecondarySkill.MagicSchoolSecondarySkillIndexes[i], 3); var inactive = new Bitmap(BitmapCache.SpellsMagicSchools[i]); using (var g = Graphics.FromImage(inactive)) { g.FillRectangle(new SolidBrush(Color.FromArgb(190, Color.Gray)), 0, 0, inactive.Width, inactive.Height); } BitmapCache.SpellsMagicSchoolsInactive[i] = inactive; } } }