コード例 #1
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(ShengToolStripImageSize size)
        {
            if (DefaultImageProvider == null)
                return false;
            if (DefaultImageProvider == this)
                return true;

            return DefaultImageProvider.IsImageSupported(size);
        }
コード例 #2
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(ImageSize size)
        {
            if (DefaultImageProvider == null)
            {
                return(false);
            }
            if (DefaultImageProvider == this)
            {
                return(true);
            }

            return(DefaultImageProvider.IsImageSupported(size));
        }
コード例 #3
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(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);
        }
コード例 #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(ImageSize size)
        {
            if (DefaultImageProvider == null)
            {
                throw new NullReferenceException();
            }

            if (DefaultImageProvider == this)
            {
                Size iconSize   = IconImageProvider.GetIconSize(size);
                Icon iconResult = null;// new Icon(Resources.stop, iconSize);
                return(iconResult.ToBitmap());
            }

            return(DefaultImageProvider.GetImage(size));
        }