View previous topic :: View next topic |
Author |
Message |
mitja
Joined: 18 Feb 2005 Posts: 19
|
Posted: Wed Jul 27, 2005 9:52 am Post subject: Setting up program icons |
|
|
I am new to DFL, so bear with me.
How do I set up large and small program icons? |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Wed Jul 27, 2005 2:16 pm Post subject: Re: Setting up program icons |
|
|
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 Windows API function LoadIconA() ( http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/resources/icons/iconreference/iconfunctions/loadicon.asp ), pass it to the constructor of a new Icon, and set that icon to the Form's icon property. You'll need to import dfl.winapi.
Code: |
import dfl.all, dfl.winapi;
class MyForm: Form
{
this()
{
this.icon = new Icon(LoadIconA(GetModuleHandleA(null), cast(char*)cast(WORD)101));
}
}
|
Resource loading should be made easier in DFL in the future. DFL should properly sort out the large and small icons.
- Chris |
|
Back to top |
|
|
mitja
Joined: 18 Feb 2005 Posts: 19
|
Posted: Thu Jul 28, 2005 10:20 am Post subject: |
|
|
Thanks! It works |
|
Back to top |
|
|
|