예제 #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Behavior.Length != 0)
            {
                hash ^= Behavior.GetHashCode();
            }
            if (Iconpositionx.Length != 0)
            {
                hash ^= Iconpositionx.GetHashCode();
            }
            if (Iconpositiony.Length != 0)
            {
                hash ^= Iconpositiony.GetHashCode();
            }
            if (Iconsize != 0D)
            {
                hash ^= Iconsize.GetHashCode();
            }
            if (Path.Length != 0)
            {
                hash ^= Path.GetHashCode();
            }
            if (Colormatch.Length != 0)
            {
                hash ^= Colormatch.GetHashCode();
            }
            if (Zoom.Length != 0)
            {
                hash ^= Zoom.GetHashCode();
            }
            return(hash);
        }
예제 #2
0
        /// <summary>
        /// Static function to load a bitmap for the specified image
        /// </summary>
        /// <param name="iconName"></param>
        /// <returns></returns>
        public static string GetIconName(string iconName, Iconsize iconsize)
        {
            // ok first determine if the image exists
            string imagesPath = Path.Combine(Application.StartupPath, "Icons");
            string subfolder  = (iconsize == Iconsize.Small) ? "small" : (iconsize == Iconsize.Medium) ? "medium" : "large";

            imagesPath = Path.Combine(imagesPath, subfolder);
            string imageName = Path.Combine(imagesPath, iconName);

            // If this image name does not specify a file extension then assume .png
            if (Path.GetExtension(imageName) == "")
            {
                imageName += ".png";
            }

            return(imageName);
        }
예제 #3
0
        /// <summary>
        /// Static function to load a bitmap for the specified image
        /// </summary>
        /// <param name="iconName"></param>
        /// <param name="iconsize"></param>
        /// <returns></returns>
        public static Bitmap LoadIcon(string iconName, Iconsize iconsize)
        {
            string imageName = GetIconName(iconName, iconsize);

            // Does this file exist?
            if (!File.Exists(imageName))
            {
                // No - use the 'default' image
                imageName = GetIconName("missingimage.png", iconsize);

                // If this does not exist also then we must exit as we cannot set an imae
                if (!File.Exists(imageName))
                {
                    return(null);
                }
            }

            return(new Bitmap(imageName));
        }