/// <summary>
        /// Queries the image provider for support of a specific size.
        /// </summary>
        /// <param name="size">Indicated image size.</param>
        /// <returns>Returns true when the requested size is supported.</returns>
        public virtual bool IsImageSupported(ShengToolStripImageSize size)
        {
            if (DefaultImageProvider == null)
                return false;
            if (DefaultImageProvider == this)
                return true;

            return DefaultImageProvider.IsImageSupported(size);
        }
        /// <summary>
        /// Fetches an image of the requested size.
        /// </summary>
        /// <param name="size">Size of image to obtain.</param>
        /// <returns>If supported, returns requested image. A value of null
        /// indicates that the requested size is not supported.</returns>
        public virtual Image GetImage(ShengToolStripImageSize size)
        {
            if (DefaultImageProvider == null)
                throw new NullReferenceException();

            if (DefaultImageProvider == this)
            {
                Size iconSize = ShengToolStripIconImageProvider.GetIconSize(size);
                Bitmap icon = new Bitmap(16, 16);
                Icon iconResult = new Icon(DrawingTool.ImageToIcon(icon), iconSize);
                return iconResult.ToBitmap();
            }

            return DefaultImageProvider.GetImage(size);
        }
 /// <summary>
 /// A utility method which transforms an enumerated image value into
 /// a two-dimensional size.
 /// </summary>
 /// <param name="size">Requested image size.</param>
 /// <returns>Returns a two-dimensional size.</returns>
 public static Size GetIconSize(ShengToolStripImageSize size)
 {
     switch (size)
     {
         case ShengToolStripImageSize.Small:
             return new Size(16, 16);
         case ShengToolStripImageSize.Medium:
             return new Size(24, 24);
         case ShengToolStripImageSize.Large:
             return new Size(32, 32);
         case ShengToolStripImageSize.ExtraLarge:
             return new Size(48, 48);
         default:
             throw new NotSupportedException("Invalid image size requested.");
     }
 }
 /// <summary>
 /// Fetches an image of the requested size.
 /// </summary>
 /// <param name="key">Key used to identify an image.</param>
 /// <param name="size">Size of image to obtain.</param>
 /// <returns>If supported, returns requested image. A value of null
 /// indicates that the requested size is not supported.</returns>
 public virtual Image GetImage(object key, ShengToolStripImageSize size)
 {
     return ImageProvider.GetImage(key, size);
 }
 /// <summary>
 /// Queries the image provider for support of a specific size.
 /// </summary>
 /// <param name="key">Key used to identify an image.</param>
 /// <param name="size">Indicated image size</param>
 /// <returns>Returns true when the requested size is supported.</returns>
 public virtual bool IsImageSupported(object key, ShengToolStripImageSize size)
 {
     return ImageProvider.IsImageSupported(key, size);
 }
 public ShengToolStripImageSizeChangingEventArgs(ShengToolStripImageSize oldValue, ShengToolStripImageSize newValue)
     : base(false)
 {
     this.m_currentValue = oldValue;
     this.m_newValue = newValue;
 }
 /// <summary>
 /// Fetches an image of the requested size.
 /// </summary>
 /// <param name="size">Size of image to obtain.</param>
 /// <returns>If supported, returns requested image. A value of null
 /// indicates that the requested size is not supported.</returns>
 public Image GetImage(ShengToolStripImageSize size)
 {
     Icon desiredSize = new Icon(SourceIcon, ShengToolStripIconImageProvider.GetIconSize(size));
     return desiredSize.ToBitmap();
 }
 /// <summary>
 /// Queries the image provider for support of a specific size.
 /// </summary>
 /// <param name="size">Indicated image size.</param>
 /// <returns>Returns true when the requested size is supported.</returns>
 public bool IsImageSupported(ShengToolStripImageSize size)
 {
     return true;
 }
 /// <summary>
 /// Fetches an image of the requested size.
 /// </summary>
 /// <param name="key">Key used to identify an image.</param>
 /// <param name="size">Size of image to obtain.</param>
 /// <returns>If supported, returns requested image. A value of null
 /// indicates that the requested size is not supported.</returns>
 public Image GetImage(object key, ShengToolStripImageSize size)
 {
     if (!this.ContainsKey(key))
         throw new NullReferenceException();
     return this[key].GetImage(size);
 }
 /// <summary>
 /// Queries the image provider for support of a specific size.
 /// </summary>
 /// <param name="key">Key used to identify an image.</param>
 /// <param name="size">Indicated image size</param>
 /// <returns>Returns true when the requested size is supported.</returns>
 public bool IsImageSupported(object key, ShengToolStripImageSize size)
 {
     if (!this.ContainsKey(key))
         return false;
     return this[key].IsImageSupported(size);
 }