How can I use my own icons for components developed with Delphi? What are the mysteries in it?
To use your own icons for a widget, perform the following steps:
(1) Know the component information: the component name I want to register is tnwtreport, which is in the nwtreport. Pas unit.
(2) create a DCR file with the same name as the unit file of your component. Here it is nwtreport. DCR: Add a 24*24 bitmap file to this file. The file name must be the same as your component name and all must be in uppercase.
Tnwtreport.
(3) Place the nwtreport. DCR in the same directory of the component unit nwtreport. Pas.
(4) Add the nwtreport. Pas component unit again in your component package nwtreport7.dpk. In this case, the nwtreport7.dpk component package will automatically add a DCR file nwtreport. DCR.
(5) re-compile and install it.
Note: You can use the image editor software provided by Delphi to complete the above work.
DCR is actually a resource file that can contain several 16-color bitmaps of 24x24 size. These bitmaps are only used during design and are the icons that represent the control displayed in the component Platte. When the IDE loads a package XXX. BPL,
It will find a file named XXX in the directory where the package is located. DCR file. If it is found, the file will be loaded. For the component named YYY in the package, the resource item (Bitmap) named YYY will be searched in the resource. If it is found, the resource will be called.
The source item is drawn in the component Platte to represent the component yyy. If no bitmap is found, the default bitmap is used to draw components in the package. These bitmaps are not used during runtime, so such files are not compiled into DCU or EXE (BPL. Any
Tools that can open res files should be able to open DCR files. After opening, each item can be saved as a BMP file and can be reused.