Ejemplo n.º 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);
 }
Ejemplo n.º 2
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 = (Kernel32.FILEGRPICONDIR)Marshal.PtrToStructure(
                lpData, typeof(Kernel32.FILEGRPICONDIR));

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

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

            return(lpEntry);
        }
Ejemplo n.º 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(Kernel32.ResourceTypes.RT_CURSOR), id, language)
 {
 }
Ejemplo n.º 4
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(Kernel32.ResourceTypes.RT_ICON), id, language)
 {
 }
Ejemplo n.º 5
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(Kernel32.ResourceTypes.RT_ICON), id, language)
        {

        }
Ejemplo n.º 6
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(Kernel32.ResourceTypes.RT_CURSOR), id, language)
        {

        }
Ejemplo n.º 7
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 = (Kernel32.FILEGRPICONDIR)Marshal.PtrToStructure(
                lpData, typeof(Kernel32.FILEGRPICONDIR));

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

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

            return lpEntry;
        }
Ejemplo n.º 8
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);
 }