devxlogo

How do I create a bitmap for the component palette?

How do I create a bitmap for the component palette?

Question:
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?

Answer:
Follow these easy steps. The only difficult one will be decidingon a bitmap.

  1. Run the Delphi Image Editor
  2. 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
  3. Select the “Component Resource(DCR)” radio button
  4. Click the OK button
      Untitled1.DCR dialog appears
  5. Make sure you’re on the Bitmaps tab
  6. Click on the New button
      New Resource dialog appears
  7. Select the Bitmap radio button
  8. Click on the OK button
      New Bitmap Attributes dialog appears
  9. In the “Size in Pixels” frame, change the Width and the Height to 24.
  10. Click the OK button.
  11. The Bitmap Editor now appears, so go to work.
  12. Close the Bitmap Editor when finished
  13. 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.
  14. Repeat steps 5 through 13 to add additional bitmaps for othercomponents that reside in the same unit.
  15. 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.
  16. Rebuild your library, and your new bitmap should appear.
    See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist