/// <summary>
        /// Gets the icon entry with the specified width and height.
        /// </summary>
        /// <param name="size">Width and height of the entry to get.</param>
        /// <param name="bestSupported">The "best" entry type allowed to get.
        /// Use Compressed to get all entries; TrueColor to get all except
        /// the Vista-only compressed entries; and Classic to get only the
        /// classic icons that run on all Windows versions.
        /// </param>
        /// <returns>Gets the entry matching the size. If multiple supported
        /// entries are available, the only with the highest color depth is returned.
        /// If no matching entry is found, null is returned.</returns>
        public IconEntry GetEntry(Size size, IconEntryType bestSupported)
        {
            IconEntry best = null;

            foreach (IconEntry e in this.Icons)
            {
                if (e.Size == size && e.Type <= bestSupported)
                {
                    if (best == null || best.ColorDepth < e.ColorDepth)
                    {
                        best = e;
                    }
                }
            }
            return(best);
        }
Beispiel #2
0
		/// <summary>
		/// Gets the icon entry with the specified width and height.
		/// </summary>
		/// <param name="size">Width and height of the entry to get.</param>
		/// <param name="bestSupported">The "best" entry type allowed to get.
		/// Use Compressed to get all entries; TrueColor to get all except
		/// the Vista-only compressed entries; and Classic to get only the
		/// classic icons that run on all Windows versions.
		/// </param>
		/// <returns>Gets the entry matching the size. If multiple supported
		/// entries are available, the only with the highest color depth is returned.
		/// If no matching entry is found, null is returned.</returns>
		public IconEntry GetEntry(Size size, IconEntryType bestSupported)
		{
			IconEntry best = null;
			foreach (IconEntry e in this.Icons) {
				if (e.Size == size && e.Type <= bestSupported) {
					if (best == null || best.ColorDepth < e.ColorDepth) {
						best = e;
					}
				}
			}
			return best;
		}