Home Component Writing
New Blog Posts: Merging Reports - Part 1 and Part 2

Use custom icon on own component

edited November 2013 in Component Writing
Hello,

with the following code i added an own component to designer toolbar.

ppRegisterComponent(TMyVariable, 'Standard Components', 11, 0,
MyVariable', 0);

Can I have for my component an custom icon like on Label, Checkbox, etc. ?

I analyse the code of the checkbox but i didn't found anything with an icon.

Sincerely

Christian

Comments

  • edited November 2013
    Hi Christian,

    Once you register your component with the ppRegisterComponent routine,
    ReportBuilder will look for a bitmap and mask resource with the same
    name as the component class for the icon (in your case TMYVARIABLE and
    TMYVARIABLEMASK).

    You will notice at the top of the implementation section of the
    MyChkBox.pas file, there is the following line which includes the
    checkbox bitmap resource file:

    {$R myChkBox.res}

    If you take a look inside this resource file you will see the Checkbox
    and DBCheckbox bitmaps embedded with the names TMYCHECKBOX,
    TMYCHECKBOXMASK, TMYDBCHECKBOX, and TMYDBCHECKBOXMASK respectively.

    If you aren't already, I highly recommend using the following free
    application written by Anders Melander in Delphi to create/edit resource
    files.

    http://melander.dk/reseditor

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2013
    Thanks, it works

This discussion has been closed.