Link to home
Start Free TrialLog in
Avatar of GreenNewt
GreenNewt

asked on

Component

Hello,

I have a .pas file with all my fav functions I have made ect. I want to make it into a drop Component I can put on my projects, Also I want to beable to pic the icon of what the Component is..

Thanks Newt
ASKER CERTIFIED SOLUTION
Avatar of shaneholmes
shaneholmes

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of shaneholmes
shaneholmes

as for adding a component image, you will need to create a  resource file using the image editor included
with Delphi, then in that resource file add a new Bitmap 24x24 (16 colors is what I use) name that
bitmap the same as the name of the new class, so if your new class is TMYCOMPONENT the bitmap would be
named TMYCOMPONENT as well then after you get done with that when you save the resource file itself name it the same as the component's .pas file except use a .dcr extenstion e.g.

If you component is contained in a unit named MyComp.pas you would save the resource file as MyComp.dcr, if this dcr files accessible during the compile then that will be the bitmap used to represent your component on the palette and when you drop it on forms.

Shane
is fav = favorite ?
What is a component ?
You can use 1 or more TEdits, TMemos or TLabels in the same project and every of them is independent and working as individually....
What about your fav functions (if fav = favorites) ? It is enough to be placed into a unit. Then this unit is declared into the uses clause of every other unit which calls one or more of favorite mwthods.
It is not necessary to be a components, you don't need more instances of it....
emil
Avatar of Russell Libby
Regarding the component resource (which controls the component image in), you should use the Image Editor that comes with Delphi.

File | New | Component Resource
Resource | New | Bitmap
Height and width should be set to 24x24, 16 color
Rename this image to be that of the component (TWhatever)

Save the .dcr file with the same filename that the component unit is called.

So you should have

compsource.pas
compsource.dcr

-----------

Regards,
Russell

Avatar of GreenNewt

ASKER

Thx