Delphi Control Development Tips

Alen IBRIC
1 min readNov 8, 2024

--

  • Whether a custom control is displayed in the IDE Palette depends on whether the base class of the custom control is related to the VCL or FMX framework.
  • If the project uses the VCL framework, the IDE will naturally only show framework-independent controls and those inherited from VCL classes.
  • If the project uses the FMX framework, the IDE will naturally only show framework-independent controls and those inherited from FMX classes.
  • Available Platforms for Controls
  • The target platforms defined in the .dpk file determine the platforms on which the control will be available in the IDE after installation. If the current project’s target platform is not included in the control’s defined platform range, the control will appear grayed out and be unavailable.

Method for Creating Custom Icons

  1. Assume the control class name is TMyComponent. Create a new file named test.rc with the following content:

TMyComponent Bitmap aaaa.bmp

  • where aaaa.bmp is the image file name, sized at 24×24 pixels, usually with no more than 256 colors.
  1. Run the following command in the command prompt:

brcc32 test.rc

  • This generates a test.res file.
  • Change the file extension of test.res to .dcr.
  • In the .dpk source code, add the following line:

{$R test.dcr}

Recompile, and the custom icon should be added.

--

--

Alen IBRIC
Alen IBRIC

No responses yet