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

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;

Embedding

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;

Part 1 - Adding an ImageList

Step 1

Select the Win32 tab in the Delphi Component Palette.

Select the Win32 tab in the Delphi Component Palette

Step 2

Select the ImageList control from the tab, and click on the form to insert the component.

Select the ImageList control      Click on the form to insert the ImageList component

Part 2 - Setting ImageList properties

Step 1

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.

Using the Object Inspector, set the Height and Width properties to the size of the images you are using

Step 2

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.

You can optionally set the BkColor property to set clFuchsia as the transparent colour (or force a different one)

Part 3 - Adding icons to the ImageList

Step 1

Double click the ImageList component to invoke the Image List Editor.

Double click the ImageList component to invoke the Image List Editor

Step 2

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.

Click the Add button in the Image List Editor window to insert icons into the ImageList

Step 3

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).

Image List Editor window with an icon added

Part 4 - Using the ImageList

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.

Step 1

Select the ToolBar control from the Win32 tab in the Component Palette. Click on the form to insert the control.

Select the ToolBar control from the Win32 tab in the Component Palette      Click on the form to insert the ToolBar Control

Step 2

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.

Select the ImageList control for the ToolBar, using the Object Inspector

Step 3

Right click on the ToolBar control, and select New Button from the context menu. This creates a tool button on the ToolBar control.

Right click on the ToolBar control, and select New Button to create a tool button

Step 4

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.

Select the tool button and click the ImageIndex dropdown button in the Object Inspector to select an image to use on the button

 

Step 5

The final result - a ToolBar control containing a high quality glyFX icon!

The final result - a ToolBar control with a high quality glyFX icon

Embedding: Part 1 - Adding images to controls

This example shows how to add an image directly to a Button control, the procedure is similar for other controls.

Step 1

Select the Additional tab in the Delphi Component Palette.

Select the Additional tab in the Delphi Component Palette

Step 2

Select the BitBtn control and drag the button to the form.

Select the BitBtn control      Drag the Bit Button to your form

Step 3

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.

In the Object Inspector, click the Glyph button to open the Picture Editor      The Picture Editor lets you select icons for your controls

Step 4

The final result - a button control containing a high quality glyFX toolbar icon!

The final result - a button control with a high quality glyFX icon

My Account

Lost your password? Create account!