大家有没有编写或保存ico的程序源码呢?小弟找了很久,好象delphi没有这方面的例子。在线等待。

解决方案 »

  1.   

    delphi自带的Image Edit就可以制做*.ico文件类型!自己看吧!要做得好ico,就要看你自己的美术功底了!
      

  2.   

    最好的ICON编辑软件
    MicroAngelo
    http://www.51icon.net/web/software_view.asp?SuperCode=icon&LargeCode=software&id=2
      

  3.   

    delphi有一个自带的demo
    Borland\delphi7\demos\resxplor
      

  4.   

    现在有一个bitmap 是32位色的图片,现在我想保存为32位真彩色图标。我想用自已编写的程序来保存。但我没有找到保存图标方面的资料。关于delphi编写图标的资料实在太少了。所以请大家帮助一下。
      

  5.   

    [Icon格式的资料]
    what's in an icon?
    an icon resource can contain multiple icon images. for example, one icon resource--in this case, a single .ico file--can contain images in several sizes and color depths: 
    the ico file
    an icon file, which usually has the ico extension, contains one icon resource. given that an icon resource can contain multiple images, it is no surprise that the file begins with an icon directory:
    typedef struct
    {
    word           idreserved;   // reserved (must be 0)
    word           idtype;       // resource type (1 for icons)
    word           idcount;      // how many images?
    icondirentry   identries[1]; // an entry for each image (idcount of 'em)
    } icondir, *lpicondir;
    the idcount member indicates how many images are present in the icon resource. the size of the identries array is determined by idcount. there exists one icondirentry for each icon image in the file, providing details about its location in the file, size and color depth. the icondirentry structure is defined as:
    typedef struct
    {
    byte        bwidth;          // width, in pixels, of the image
    byte        bheight;         // height, in pixels, of the image
    byte        bcolorcount;     // number of colors in image (0 if >=8bpp)
    byte        breserved;       // reserved ( must be 0)
    word        wplanes;         // color planes
    word        wbitcount;       // bits per pixel
    dword       dwbytesinres;    // how many bytes in this resource?
    dword       dwimageoffset;   // where in the file is this image?
    } icondirentry, *lpicondirentry;
    for each icondirentry, the file contains an icon image. the dwbytesinres member indicates the size of the image data. this image data can be found dwimageoffset bytes from the beginning of the file, and is stored in the following format:
    typdef struct
    {
    bitmapinfoheader   icheader;      // dib header
    rgbquad         iccolors[1];   // color table
    byte            icxor[1];      // dib bits for xor mask
    byte            icand[1];      // dib bits for and mask
    } iconimage, *lpiconimage;the icheader member has the form of a dib bitmapinfoheader. only the following members are used: bisize, biwidth, biheight, biplanes, bibitcount, bisizeimage. all other members must be 0. the biheight member specifies the combined height of the xor and and masks. the members of icheader define the contents and sizes of the other elements of the iconimage structure in the same way that the bitmapinfoheader structure defines a cf_dib format dib.
    the iccolors member is an array of rgbquads. the number of elements in this array is determined by examining the icheader member.
    the icxor member contains the dib bits for the xor mask of the image. the number of bytes in this array is determined by examining the icheader member. the xor mask is the color portion of the image and is applied to the destination using the xor operation after the application of the and mask.
    the icand member contains the bits for the monochrome and mask. the number of bytes in this array is determined by examining the icheader member, and assuming 1bpp. the dimensions of this bitmap must be the same as the dimensions of the xor mask. the and mask is applied to the destination using the and operation, to preserve or remove destination pixels before applying the xor mask.
    note the biheight member of the icheader structure represents the combined height of the xor and and masks. remember to divide this number by two before
      

  6.   

    delphi这方的例子一点都没有吗?我有vb,与vc方面的例子。但水平不行,不能转换为delphi.所以来请高手指点一二呢。先说一声谢谢呢。
      

  7.   

    bmp 转换为 ico:
    procedure Bmp2Ico(bmp, ico: string); 
    var
      IconSizeX : integer;
      IconSizeY : integer;
      myBmp : TBitmap;
      AndMask : TBitmap;
      XOrMask : TBitmap;
      IconInfo : TIconInfo;
      Icon : TIcon;
    begin
      IconSizeX := GetSystemMetrics(SM_CXICON);
      IconSizeY := GetSystemMetrics(SM_CYICON);  myBmp := TBitmap.Create;
      myBmp.LoadFromFile(bmp);  AndMask := TBitmap.Create;
      AndMask.Width := IconSizeX;
      AndMask.Height := IconSizeY;
      AndMask.Canvas.Brush.Color := clBlack;
      AndMask.Canvas.Rectangle(0, 0, IconSizeX, IconSizeY);  XOrMask := TBitmap.Create;
      XOrMask.Width := IconSizeX;
      XOrMask.Height := IconSizeY;
      StretchBlt(XorMask.Canvas.Handle, 0, 0, IconSizeX, IconSizeY,
                 myBmp.Canvas.Handle, 0, 0, myBmp.Width, myBmp.Height, SRCCOPY);  Icon := TIcon.Create;
      IconInfo.fIcon := true;
      IconInfo.xHotspot := 0;
      IconInfo.yHotspot := 0;
      IconInfo.hbmMask := AndMask.Handle;
      IconInfo.hbmColor := XOrMask.Handle;
      Icon.Handle := CreateIconIndirect(IconInfo);  AndMask.Free;
      XOrMask.Free;
      myBmp.Free;  Icon.SaveToFile(ico);
      Icon.Free;
    end;
      

  8.   

    一定要在delphi里面做的吗用其它软件也行的啊
      

  9.   

    还是IconCool软件来的好Delphi自己的Icon处理默认不支持真彩的Ico和Mutil Icon格式的http://lysoft.7u7.net
      

  10.   

    支持24位色还是有办法的,难的是让它支持alpha通道
      

  11.   

    哪有那么难,ico已经是非常简单的格式了,你了解Bitmap吗?ico就一样~~~Icon-Resource File FormatAn icon-resource file contains image data for icons used by Windows
    applications. The file consists of an icon directory identifying the number
    and types of icon images in the file, plus one or more icon images. The
    default filename extension for an icon-resource file is .ICO.Icon DirectoryEach icon-resource file starts with an icon directory. The icon directory,
    defined as an ICONDIR structure, specifies the number of icons in the
    resource and the dimensions and color format of each icon image. The ICONDIR
    structure has the following form:typedef struct ICONDIR {
        WORD          idReserved;
        WORD          idType;
        WORD          idCount;
        ICONDIRENTRY  idEntries[1];
    } ICONHEADER;Following are the members in the ICONDIR structure:idReserved      Reserved; must be zero. 
    idType          Specifies the resource type. This member is set to 1. 
    idCount         Specifies the number of entries in the directory. 
    idEntries       Specifies an array of ICONDIRENTRY structures containing
    information about individual icons. The idCount member specifies the number
    of structures in the array.The ICONDIRENTRY structure specifies the dimensions and color format for an
    icon. The structure has the following form:struct IconDirectoryEntry {
        BYTE  bWidth;
        BYTE  bHeight;
        BYTE  bColorCount;
        BYTE  bReserved;
        WORD  wPlanes;
        WORD  wBitCount;
        DWORD dwBytesInRes;
        DWORD dwImageOffset;
    };Following are the members in the ICONDIRENTRY structure: bWidth          Specifies the width of the icon, in pixels. Acceptable values
    are 16, 32, and 64.bHeight         Specifies the height of the icon, in pixels. Acceptable
    values are 16, 32, and 64.bColorCount     Specifies the number of colors in the icon. Acceptable values
    are 2, 8, and 16.bReserved       Reserved; must be zero. 
    wPlanes         Specifies the number of color planes in the icon bitmap. 
    wBitCount       Specifies the number of bits in the icon bitmap. 
    dwBytesInRes    Specifies the size of the resource, in bytes. 
    dwImageOffset   Specifies the offset, in bytes, from the beginning of the
    file to the icon image.Icon ImageEach icon-resource file contains one icon image for each image identified in
    the icon directory. An icon image consists of an icon-image header, a color
    table, an XOR mask, and an AND mask. The icon image has the following form:BITMAPINFOHEADER    icHeader;
    RGBQUAD             icColors[];
    BYTE                icXOR[];
    BYTE                icAND[];The icon-image header, defined as a BITMAPINFOHEADER structure, specifies the
    dimensions and color format of the icon bitmap. Only the biSize through
    biBitCount members and the biSizeImage member are used. All other members
    (such as biCompression and biClrImportant) must be set to zero.The color table, defined as an array of RGBQUAD structures, specifies the
    colors used in the XOR mask. As with the color table in a bitmap file, the
    biBitCount member in the icon-image header determines the number of elements
    in the array. For more information about the color table, see Section 1.1,
    "Bitmap-File Formats."The XOR mask, immediately following the color table, is an array of BYTE
    values representing consecutive rows of a bitmap. The bitmap defines the
    basic shape and color of the icon image. As with the bitmap bits in a bitmap
    file, the bitmap data in an icon-resource file is organized in scan lines,
    with each byte representing one or more pixels, as defined by the color
    format. For more information about these bitmap bits, see Section 1.1,
    "Bitmap-File Formats."The AND mask, immediately following the XOR mask, is an array of BYTE values,
    representing a monochrome bitmap with the same width and height as the XOR
    mask. The array is organized in scan lines, with each byte representing 8
    pixels.When Windows draws an icon, it uses the AND and XOR masks to combine the icon
    image with the pixels already on the display surface. Windows first applies
    the AND mask by using a bitwise AND operation; this preserves or removes
    existing pixel color.  Windows then applies the XOR mask by using a bitwise
    XOR operation. This sets the final color for each pixel.The following illustration shows the XOR and AND masks that create a
    monochrome icon (measuring 8 pixels by 8 pixels) in the form of an uppercase
    K:Windows Icon SelectionWindows detects the resolution of the current display and matches it against
    the width and height specified for each version of the icon image. If Windows
    determines that there is an exact match between an icon image and the current
    device, it uses the matching image. Otherwise, it selects the closest match
    and stretches the image to the proper size.If an icon-resource file contains more than one image for a particular
    resolution, Windows uses the icon image that most closely matches the color
    capabilities of the current display. If no image matches the device
    capabilities exactly, Windows selects the image that has the greatest number
    of colors without exceeding the number of display colors. If all images
    exceed the color capabilities of the current display, Windows uses the icon
    image with the least number of colors.