![| Embarcadero RAD Studio Delphi C++Builder Blogs the future of starts demands massive productivity](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2020/08/delphi_circuit.jpg?resize=1140%2C628&ssl=1)
Author: Pawe Gowacki
I have just recently discovered a super easy way of adding custom icons to Delphi components. Traditionally you had to start from a rectangular bitmap of a specific size and color depth and then use Image Editor. This is documented in many places including Stackoverflow.
After a little bit of googling I have come across another Stackoverflow post that inspired my to give it a try and do it simpler. I wanted to have a big image and not square. Google image search with proper property rights filter typically sends me to wikipedia. Here is the link to high resolution image of the bike that I want to use as a icon for my component.
1) Save the image as a bitmap file, but the file is huge – 40 MB and 4819×2968 pixels. That’s OK!
2) Create a new Delphi package project. To keep the steps simple let’s stick with just one “designtime and runtime” package. Normally you should split your custom component into one designtime and one runtime package. Give the package whatever name. For example “PackageMySuperComponent”.
3) Add to the package an empty unit for the custom component code. Save it for example as “uMySuperComponent.pas”.
4) To keep it super simple just add a dummy “TMySuperComponent” declaration. Something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
unit uMySuperComponent; interface uses System.Classes; type TMySuperComponent = class(TComponent) end; procedure Register; implementation procedure Register; begin RegisterComponents('Samples', [TMySuperComponent]); end; end. |
5) Save All. Now go to “Resources and Images” dialog in the “Project” menu. Add the bitmap to the package project, making sure that the bitmap identifier is the same as the name of the custom component. In our case this is “TMySuperComponent”.
![](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2020/08/Res_5F00_and_5F00_images_5F00_my_5F00_super_5F00_comp.png?w=750&ssl=1)
6) Now right-click on the package in the Project Manager and from the context menu select “Build” and then “Install”. You should get the message that the component was successfully installed. Optionally restart the IDE.
7) Create a new visual Delphi app. In the Tool Palette you should find new “Samples” category with a new component with custom image.
![](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2020/08/super_5F00_comp_5F00_on_5F00_the_5F00_form.png?w=750&ssl=1)
It seems to be a not very documented, but I hope that this approach is OK to use and that you will find it useful!
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition
I have Tried with bitmaps, Icons and png, but it doesn’t seems to work. I Still get the default icon.
OK this is quite an old article. I’ve updated it to make the syntax of the example a bit clearer. I can’t tell from your comment what steps you took and therefore which bit might be wrong.
I recommend trying the steps in the following article which is a little bit more comprehensive: https://stackoverflow.com/questions/6999939/best-way-to-make-a-component-icon-in-delphi-xe-using-only-the-built-in-tools