ListIconGadget with JPG images
Posted: Sat Aug 13, 2005 3:49 am
I'm trying to create a ListIconGadget with 16x16 pixel images for their icons
as previews. The following code doesn't work (you'll need to supply 5 jpg
images called c:\1.jpg, c:\2.jpg, c:\3.jpg, c:\4.jpg, c:\5.jpg). Any ideas?
Note: If I remove the ResizeImage line, it works, but then I only see the
topleft 16 pixels of each image for the icons, which is obviously useless.
Also, it's likely that I'll have a LOT of such icons... is there a limit to the
number of LoadImages I can do in PureBasic? Say, 2000 or so?
Each image will only be 16x16 pixels in size though, if that helps...
as previews. The following code doesn't work (you'll need to supply 5 jpg
images called c:\1.jpg, c:\2.jpg, c:\3.jpg, c:\4.jpg, c:\5.jpg). Any ideas?
Note: If I remove the ResizeImage line, it works, but then I only see the
topleft 16 pixels of each image for the icons, which is obviously useless.
Also, it's likely that I'll have a LOT of such icons... is there a limit to the
number of LoadImages I can do in PureBasic? Say, 2000 or so?

Each image will only be 16x16 pixels in size though, if that helps...
Code: Select all
UseJPEGImageDecoder()
If OpenWindow(0,300,200,300,300,#PB_Window_SystemMenu,"test")
CreateGadgetList(WindowID())
ListIconGadget(0,10,10,250,300,"test",200)
For r=1 To 5
p+1 : a=LoadImage(p,"c:\"+Str(r)+".jpg")
ResizeImage(p,16,16)
AddGadgetItem(0,-1,"Item "+Str(r),a)
Next
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf