View Full Version : Component Icon
I've been creating my own set of components for a few things that I like to use throughout many projects and I would like to add Icon's to the component that's displayed in the delphi ide. Im not sure how this is done. Anyone can walk thru it real fast?
Harry Hunt
19-05-2005, 06:40 PM
You need to make a DCR file with the icon in it.
Create a Bitmap first. The size shouldn't exceed 24x24 or it will get clipped. Any color depth is fine (although alpha transparency isn't supported).
Now you need to create a resource file. Either use the Image Editor that comes with Delphi or use the borland resource compiler (BRCC32.exe, can be found in the \bin folder) and a resource script. Make sure you name the bitmap resource identical to the class name you're creating the icon for. So if your class is called TMyButton the Bitmap resource should be called TMYBUTTON. I'm pretty sure the all-uppercase is required.
I recommend using a resource script since that will allow you to create better looking icons (the image editor is restricted to 256 colors and the windows default palette).
Name the resource file the same as your .PAS file and give it a .DCR extension. That should do the trick.
Note that the pixel in the lower left corner of your image will be used to determine the color for transparency.
JSoftware
20-05-2005, 09:44 AM
{R *.dcr}
you need this to be in the main file jsut right after implementation
Harry Hunt
20-05-2005, 01:40 PM
Not working :P
ungrateful bastard :P
:cry: I didn't mean to be rude if i was :( Harry
Harry Hunt
20-05-2005, 09:29 PM
:cry: I didn't mean to be rude if i was :( Harry
i was kidding of course.
Sweet... Got it working, thanks guys :)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.