Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Combobox / Listbox icon based on file
#1
Is it possible to render icons in comboxes/listboxes based on the contents of the combobox or listbox?

For example

Code:
Copy      Help
_s will be placed in a listbox

_s=
c:\test_1
c:\test_2\img.gif
c:\test_3\subfolder_1\test.txt

c:\test_1 => FOLDER icon
c:\test_2\img.gif => gif IMAGE icon
c:\test_3\subfolder_1\test.txt => TEXTFILE icon

The icons are based on what the user has set on his system. So I wouldn't be using hard-links to .dll / .ico /image lists / ... resources.
I just use what the user has setup for his system.
#2
ComboBox and ListBox controls can display icons if they have owner-draw style. Then need to create code to draw icons. Quite much work.
Alternative: use SysListView32 control instead of ListBox. Use ComboBoxEx32 control instead of ComboBox. These controls support imagelists. Quite much work too.

To get file type icon:
Macro Macro2418
Code:
Copy      Help
__Hicon hi=GetFileIcon(".txt")
__Hicon hiFolder=GetFileIcon("$qm$")
#3
OK thank you!


Forum Jump:


Users browsing this thread: 1 Guest(s)