Example #1
0
 /// <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, SEToolStripImageSize size)
 {
     if (!this.ContainsKey(key))
     {
         throw new NullReferenceException();
     }
     return(this[key].GetImage(size));
 }
Example #2
0
 /// <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, SEToolStripImageSize size)
 {
     if (!this.ContainsKey(key))
     {
         return(false);
     }
     return(this[key].IsImageSupported(size));
 }
Example #3
0
        /// <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(SEToolStripImageSize size)
        {
            if (DefaultImageProvider == null)
            {
                return(false);
            }
            if (DefaultImageProvider == this)
            {
                return(true);
            }

            return(DefaultImageProvider.IsImageSupported(size));
        }
Example #4
0
        /// <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(SEToolStripImageSize size)
        {
            if (DefaultImageProvider == null)
            {
                throw new NullReferenceException();
            }

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

            return(DefaultImageProvider.GetImage(size));
        }
Example #5
0
        /// <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(SEToolStripImageSize size)
        {
            switch (size)
            {
            case SEToolStripImageSize.Small:
                return(new Size(16, 16));

            case SEToolStripImageSize.Medium:
                return(new Size(24, 24));

            case SEToolStripImageSize.Large:
                return(new Size(32, 32));

            case SEToolStripImageSize.ExtraLarge:
                return(new Size(48, 48));

            default:
                throw new NotSupportedException("Invalid image size requested.");
            }
        }
Example #6
0
 /// <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, SEToolStripImageSize size)
 {
     return(ImageProvider.GetImage(key, size));
 }
Example #7
0
 /// <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, SEToolStripImageSize size)
 {
     return(ImageProvider.IsImageSupported(key, size));
 }
Example #8
0
 public SEToolStripImageSizeChangingEventArgs(SEToolStripImageSize oldValue, SEToolStripImageSize newValue)
     : base(false)
 {
     this.m_currentValue = oldValue;
     this.m_newValue     = newValue;
 }
Example #9
0
        /// <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(SEToolStripImageSize size)
        {
            Icon desiredSize = new Icon(SourceIcon, SEToolStripIconImageProvider.GetIconSize(size));

            return(desiredSize.ToBitmap());
        }
Example #10
0
 /// <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(SEToolStripImageSize size)
 {
     return(true);
 }