glyFX Guides : Borland Delphi (Versions 2 - 7)
Using glyFX icons in Borland Delphi (Versions 2 - 7)
This document outlines the basic procedure on how to use the glyFX toolbar images with Borland Delphi. The steps apply to any version from 2 to 7. There may be small cosmetic interface differences, however the procedure remains the same.
There are two main mechanisms for adding icons on your controls, image lists and embedding into controls.
Image Lists allow you to keep a single object that contains all of your icons in one place. The advantage is that you can edit the images in the Image List, and the controls will automatically update if you have made any changes to those icons. If you use a particular image on more than one control it also lets you store just one copy of the image within the application, rather than within each control. This guide is broken up into 4 seperate parts;
- Part 1 - Adding an Image List
- Part 2 - Setting ImageList properties
- Part 3 - Adding icons to the Image List
- Part 4 - Using the Image List
Embedding an image directly into a control is a fast way of assigning icons to your user interface elements. The selected control will directly store the image resource. This method is not as efficient as using Image Lists, but is sometimes necessary as some controls are not compatible with Image Lists. This guide has just 1 part;
Select the Win32 tab in the Delphi Component Palette.
Select the ImageList control from the tab, and click on the form to insert the component.
Using the Object Inspector window, edit the Height and Width properties properties to the required size (depending on which sets you own, this may be 16, 24, 32, 48 or 64). Both dimensions must be the same.
Delphi can automatically work out the transparency colour of the icon. It makes the colour present at the bottom left pixel transparent throughout the image. You may set the BkColor property to force a different colour (or set it to the glyFX native clFuchsia colour) if you wish.
Double click the ImageList component to invoke the Image List Editor.
Click the Add button in the Image List Editor window. This will display a standard Windows Open File dialog, where you may select a bitmap (.BMP) image from one of the glyFX folders.
Once you have selected an image (or multiple images), the Image List Editor will display the icon you have added. You can continue adding as many images as you need (you can always edit the contents of the ImageList at a later stage).
This part demonstrates how to use the ImageList with a standard toolbar control. The procedure is very similar for other controls that support the ImageList. This includes third party controls from other vendors.
Select the ToolBar control from the Win32 tab in the Component Palette. Click on the form to insert the control.
Click the Images dropdown button in the Object Inspector, and select the ImageList control you want to use. Third party controls may use different terminology for this property.
Right click on the ToolBar control, and select New Button from the context menu. This creates a tool button on the ToolBar control.
Select the new tool button. Click the ImageIndex dropdown button in the Object Inspector and select the image you want to use on the button.
The final result - a ToolBar control containing a high quality glyFX icon!
This example shows how to add an image directly to a Button control, the procedure is similar for other controls.
Select the Additional tab in the Delphi Component Palette.
Select the BitBtn control and drag the button to the form.
Click the Glyph editor button in the Object Inspector to display the Picture Editor window. Click the Load button, which will display a standard Windows Open File dialog, where you need to select a bitmap (.BMP) image from one of the glyFX folders.
The final result - a button control containing a high quality glyFX toolbar icon!