Exemplo n.º 1
0
        /// <summary>
        /// Gets the index of the icon that best fits the current display device.
        /// </summary>
        /// <returns>The icon index.</returns>
        public int GetBestFitIconIndex()
        {
            int    iconIndex = 0;
            IntPtr resBits   = Marshal.AllocHGlobal(this.ResourceRawData.Length);

            Marshal.Copy(this.ResourceRawData, 0, resBits, this.ResourceRawData.Length);
            try { iconIndex = DllImports.LookupIconIdFromDirectory(resBits, true); }
            finally { Marshal.FreeHGlobal(resBits); }

            return(iconIndex);
        }