Chris001
Feb 3rd, 2006, 10:41 AM
Here is a great way to add icons, sidebars and small sub-titles to your menu to give your application a professional look. It's one Class Module and two normal Modules.
This code is not written by me, but by somebody named La Volpe. I'm just posting it here to share it with you. It's quite a lot of code and it will make your application about 100kB bigger, but it's very easy to use. It's also fully commented.
http://img337.imageshack.us/img337/3185/menu12ca.png
http://img141.imageshack.us/img141/3474/menu24vg.png
Add an ImageList to your form (Project -> Components -> Microsoft Windows Common Controls 6.0).
1) Right-click on the added ImageList and select Properties.
2) In the General tab, set the size to 16 x 16.
3) In the Image tab, click on 'Insert Picture...' and add your icons.
4) Add SetMenus hwnd, ImageList1 to the Form_Load event (see sample project)
5) Create your menu and add {img:1}, {img:2}, etc in front of the names of the menu options (see sample project)
6) To add a sub-title in your menu, simply add -My Title between the menu options (see sample project)
7) To add a sidebar, see the sample project or look at the comments in modMenusXP.bas.
Have fun
This code is not written by me, but by somebody named La Volpe. I'm just posting it here to share it with you. It's quite a lot of code and it will make your application about 100kB bigger, but it's very easy to use. It's also fully commented.
http://img337.imageshack.us/img337/3185/menu12ca.png
http://img141.imageshack.us/img141/3474/menu24vg.png
Add an ImageList to your form (Project -> Components -> Microsoft Windows Common Controls 6.0).
1) Right-click on the added ImageList and select Properties.
2) In the General tab, set the size to 16 x 16.
3) In the Image tab, click on 'Insert Picture...' and add your icons.
4) Add SetMenus hwnd, ImageList1 to the Form_Load event (see sample project)
5) Create your menu and add {img:1}, {img:2}, etc in front of the names of the menu options (see sample project)
6) To add a sub-title in your menu, simply add -My Title between the menu options (see sample project)
7) To add a sidebar, see the sample project or look at the comments in modMenusXP.bas.
Have fun