Best way to make a component icon in Delphi XE using only the built in tools

前端 未结 4 1408
南方客
南方客 2020-12-24 03:01

In Delphi 7, an image editor program is included, which can read and write .dcr files, which are merely binary resource files (.res files) with a

相关标签:
4条回答
  • 2020-12-24 03:15

    I have investigated the previous responses using Delphi XE5 upd2. Not much success. So I tried to build a new solution and found one derived from previous answers.

    In short: 1. Create your bitmap using Windows Paint program. 2. Create a resource script file with the bitmap. 3. Compile the script with BRCC32 to produce the dcr file 4. Include the dcr file into the package source 5. Recompile/Install the package

    To automate this, it is enough to add the BRCC32 command line into the package project "pre-build events". This way, you dcr file will be recreated before each build.

    For a detailed description, see my blog at http://francois-piette.blogspot.be/2014/02/howto-create-dcr-file-for-your-delphi.html

    0 讨论(0)
  • 2020-12-24 03:17

    Try Resource Editor. A nice replacement for old Image Editor.

    0 讨论(0)
  • 2020-12-24 03:22

    I have used and had great success with:

    • Colin Wilson's XN Resource Editor
    • Anders Melander's Resource Editor

    Update

    I just tried the following, in XE, and was successful.

    • I created a new component, TNewAnimate, in NewAnimates.pas.
    • I added TNewAnimate.pas to dclusr.dpk.
    • I added a bitmap (called TMRUComboBox.bmp, I just had that around anyway) using the Project → Resources and Images... dialog to the .dpk and gave it the name TNEWANIMATE.
    • I re-installed dclusr.dpk.

    The source file for dclusr.pdk got a new entry {$R *.dres} (note the extension). I could see the TNewAnimate in the Samples palette with the glyph in TMRUComboBox.bmp.

    I located dclusr.dres in the same directory as dclusr.dpk (which is normally under C:\Program Files, but not in my setup). I tried to open it with XN Resource Editor, but that refused to open it with a cryptic error message. It is not a normal .res file, it seems.

    enter image description here

    0 讨论(0)
  • 2020-12-24 03:36

    First add 'mypackageicons.rc' file to the project, this produces 'mypackageicons.res' at compile time (see related SO answer to the question "Including resource file in a project by .RC file rather than .RES file").

    Also include {$R mypackageicons.res mypackageicons.dcr} to the component unit (or to the .dpk). This does not produce a '.dcr file', but sets the icon for the component.


    Note that my test with a 'BMP' resource failed. I used 'BITMAP' as resource type.

    0 讨论(0)
提交回复
热议问题