Quote:
Originally Posted by derez
so the problem is not in the compiler only.
|
I've had a look at a lot of generated ImageList code over the the last 24 hours and I'm afraid it is unless Erel intended ImageList to only work properly with Form.DrawImage, or the intrinsic Image control, which I doubt.
Form.DrawImage is specified to take either a filename or a bitmap as a source image and the compiler ensures this by compiling in GetBitmapFromString for the source bitmap parameter. This is a special case, which is undesirable but I suspect is supported for backwards compatibility from before ImageLib.Bitmap was available.
Both ImageLib.Drawer.DrawImage1 and ImageLibEx.DrawerEx.DrawImage are specified to only accept a bitmap as a source image. For neither of these does the compiler include GetBitmapFromString which is understandable as they would be special cases and the compiler shouldn't make assumptions about external libraries. Instead the compiler sensibly tries to ensure that ImageList only holds bitmap references by compiling in GetBitmapFromString for ImageList.Add and ImageList.Insert. It also compiles in a similar GetBitmapFromResource function when adding the bitmaps specified at design time. To ensure the only references are held it should also do that for a direct assignment to ImageList.Item(x) which it doesn't do. I regard that as a compiler bug.