コード例 #1
1
        /// <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;
        }
コード例 #2
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);
 }
コード例 #3
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);
 }
コード例 #4
0
ファイル: IconFile.cs プロジェクト: Scavanger/resourcelib
        /// <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);
        }
コード例 #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">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)
 {
 }
コード例 #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)
 {
 }
コード例 #7
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)
        {

        }
コード例 #8
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>
 internal IconResource(IconFileIcon icon, ResourceId id, UInt16 language)
     : base(icon, new ResourceId(Kernel32.ResourceTypes.RT_ICON), id, language)
 {
 }