4

Possible Duplicate:
delphi non visual component image

How to add my icon to my created component in the component palette page?

7
  • Sometimes I ask questions not for me. Commented May 15, 2011 at 8:18
  • no i didnt know it. I just used your answer to create better answer. aaargh do you get it? Commented May 15, 2011 at 8:21
  • OK now I see. If that's all you wanted to do then you could have edited my answer. And you could have explained more. Commented May 15, 2011 at 8:23
  • @Robrok Anyway I've now voted to close this since it is an exact duplicate. I should have checked that first. Commented May 15, 2011 at 8:24
  • I cant delete this post. Help! Commented May 15, 2011 at 8:32

2 Answers 2

12

To add icon to component you need to create dcr file using Delphi image editor.
In image editor create bitmap 24x24 16 bit. Rename bitmap to your control name.
Example: TMyCustomControl - TMyCustomControl (same name)
Save dcr file in the folder where the package is with any name (example: Icon.dcr).
Then open your package and right click -> View source.
Add line :
{$R 'The dcr filename'}
In this case:
{$R 'Icon.dcr'}
Click Compile and Install.
There you go. You have created your own component with icon. :)

1
  • 2
    this is much better and easier explanation than the "possible duplicate" question's answer
    – supersan
    Commented Feb 18, 2016 at 7:15
2
  • Create a .dcr file in the Delphi Image Editor.
  • Add a bitmap to this with the same name as your control. It needs to be 24 pixels square, and use 16 colours.
  • Link this .dcr, which is really just a resource file, to your package with a $R in your .dpk for example.
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.