I created a new edit control component which I derived from TEdit,however, when I added it to the component palette, it has the samebitmap as TEdit. How do I replace it with my own?
Follow these easy steps. The only difficult one will be decidingon a bitmap.
- Run the Delphi Image Editor
- Select File|New… or click on the toolbar button that tool tiplabel of “New…” appears when the mouse point rests over it.
- New Project dialog appears
- Select the “Component Resource(DCR)” radio button
- Click the OK button
- Untitled1.DCR dialog appears
- Make sure you’re on the Bitmaps tab
- Click on the New button
- New Resource dialog appears
- Select the Bitmap radio button
- Click on the OK button
- New Bitmap Attributes dialog appears
- In the “Size in Pixels” frame, change the Width and the Height to 24.
- Click the OK button.
- The Bitmap Editor now appears, so go to work.
- Close the Bitmap Editor when finished
- Rename the bitmap resource to match the name of the componentyou want the bitmap to represent on the component palette byselecting the resource and clicking on the Rename button. It willnot appear on the component palette if the name is not identical.Although it is not case sensitive, the convention is to use all capsfor the resource name.
- Repeat steps 5 through 13 to add additional bitmaps for othercomponents that reside in the same unit.
- Save the project file in the directory of where the compiled unitthat contains your component(s) reside(s). You must give it the samename as the unit except your project file should have a .DCRextension.
- Rebuild your library, and your new bitmap should appear.