DWT Forms Icons

torhu no at spam.invalid
Sun Sep 7 18:03:28 PDT 2008


Tim M wrote:
> I found the shell.setImage really fast but I couldn't figure out where to get the image. In the examples I saw an import statement with an image file that is cast. Do you know of any better way?
> 

I think there's a way to get the resource data for the icon by using the 
Windows API, but I didn't bother to figure it out.  I just used the 
import("icon.png") trick.  Of course, that means you have to include the 
image file twice in the execuable...

Something like this is what I've been doing:

---
shell.setImage(loadImage("icon.png"));

Image loadImage(char[] name)()
{
	return _loadImage(cast(byte[])import(name));
}

Image _loadImage(byte[] data)
{
	return new Image(Display.getDefault, new ByteArrayInputStream(data));
}
---


More information about the Digitalmars-d-dwt mailing list