[archived content]
Dfl /

How to load an icon and set it to the Form.

With your icon editor make a single icon file with 16x16 and 32x32 pixel icons, and maybe 64x64 and others. Create or add an icon resource to your resource file. Make it the first one if you also want that icon to be the exe's icon.

So I have file foo.rc with this in it:
101 ICON DISCARDABLE "foo.ico"

Use the digital mars resource compiler to turn it into a res file. Note that it seems to have problems with bitmaps. You can get it from DMC's basic utilities at http://ftp.digitalmars.com/bup.zip

To compile:
rcc -32 foo.rc

Now I have a res file to use in my DFL app. Load it up with Application.resources.getIcon and set that icon to the Form's icon property.

import dfl.all;

class MyForm: Form
                this.icon = Application.resources.getIcon(101);

DFL should properly sort out the large and small icons.

Page last modified on March 05, 2007, at 01:40 PM