コード例 #1
0
 private static System.Drawing.Image IconFromDictionary(Dictionary<DrawState, System.Drawing.Image> dictionary, IconDrawable e)
 {
     if (!dictionary.ContainsKey(e.DrawState))
         throw new NotImplementedException("Missing icon for:" + e.GetType().Name + "." + e.DrawState);
     return dictionary[e.DrawState];
 }
コード例 #2
0
 /// <summary>Iterates the resources to find the specified element's proper icon</summary>
 public static System.Drawing.Image Icon(IconDrawable element)
 {
     if (element is PumpElement) return IconFromDictionary(PumpIcons, element);
     else if (element is SinkElement) return IconFromDictionary(SinkIcons, element);
     else if (element is MergerElement) return IconFromDictionary(MergerIcons, element);
     else if (element is AdjustableSplitter) return IconFromDictionary(AdjSplitterIcons, element);
     else if (element is SplitterElement) return IconFromDictionary(SplitterIcons, element);
     else if (element is ConnectionZone) return Icon(element as ConnectionZone);
     else if (element is PathMidPointDrawable) return IconFromDictionary(MidPointIcons, element);
     throw new ArgumentException("Element not implemented, " + element.GetType().Name);
 }