예제 #1
0
 /// <summary>
 ///     Create a new icon image resource from a file icon.
 /// </summary>
 /// <param name="icon">File icon.</param>
 /// <param name="type">Resource type.</param>
 /// <param name="name">Resource id.</param>
 /// <param name="language">Resource language.</param>
 public IconImageResource(IconFileIcon icon, ResourceId type, ResourceId name, UInt16 language)
 {
     _name = name;
     _type = type;
     _language = language;
     _header.bColors = icon.Header.bColors;
     _header.bHeight = icon.Header.bHeight;
     _header.bReserved = icon.Header.bReserved;
     _header.bWidth = icon.Header.bWidth;
     _header.dwImageSize = icon.Header.dwImageSize;
     _header.wBitsPerPixel = icon.Header.wBitsPerPixel;
     _header.wPlanes = icon.Header.wPlanes;
     _header.nID = (UInt16)name.Id;
     _image = new DeviceIndependentBitmap(icon.Image);
 }
예제 #2
0
 /// <summary>
 ///     Convert into an icon resource that can be written into an executable.
 /// </summary>
 /// <param name="icon">Icon image.</param>
 /// <param name="id">Icon Id.</param>
 /// <param name="language">Resource language.</param>
 /// <returns>An icon resource.</returns>
 public IconResource(IconFileIcon icon, ResourceId id, UInt16 language)
     : base(icon, new ResourceId(ResourceTypes.RT_ICON), id, language)
 {
 }
예제 #3
0
 /// <summary>
 ///     Convert into an icon resource that can be written into an executable.
 /// </summary>
 /// <param name="icon">Icon image.</param>
 /// <param name="id">Icon Id.</param>
 /// <param name="language">Language.</param>
 /// <returns>An icon resource.</returns>
 public CursorResource(IconFileIcon icon, ResourceId id, UInt16 language)
     : base(icon, new ResourceId(ResourceTypes.RT_CURSOR), id, language)
 {
 }
예제 #4
0
        /// <summary>
        ///     Read icons.
        /// </summary>
        /// <param name="lpData">Pointer to the beginning of a FILEGRPICONDIR structure.</param>
        /// <returns>Pointer to the end of a FILEGRPICONDIR structure.</returns>
        internal IntPtr Read(IntPtr lpData)
        {
            Icons.Clear();

            _header = (FileGrpIconDir)Marshal.PtrToStructure(lpData, typeof (FileGrpIconDir));

            var lpEntry = new IntPtr(lpData.ToInt32() + Marshal.SizeOf(_header));

            for (var i = 0; i < _header.wCount; i++) {
                var iconFileIcon = new IconFileIcon();
                lpEntry = iconFileIcon.Read(lpEntry, lpData);
                Icons.Add(iconFileIcon);
            }

            return lpEntry;
        }