Solved

Creating a png/bitmap image with collection of icons

Posted on 2016-11-07
4
41 Views
Last Modified: 2016-11-29
Icons
I cannot find any instructions of how to create a single png/bitmap file that would contain a number of images. In our vb app i would load these and use in my menu.

Any help greatly appreciated.

Ed
0
Comment
Question by:sprintdata
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 11

Expert Comment

by:louisfr
ID: 41878521
Which VB are you targeting? All three?
0
 

Author Comment

by:sprintdata
ID: 41878633
Hello Louisfr

I am targeting VB6 currently and moving to .Net next year ;)
0
 
LVL 11

Accepted Solution

by:
louisfr earned 500 total points (awarded by participants)
ID: 41880019
In VB6, you can use a PictureClip control to load one picture and extract parts of it.
You can use the GetMenu, GetSubMenu and SetMenuItemBitmaps functions to add images to the menu.
Here's an example:
Private Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long

Private Declare Function GetSubMenu Lib "user32" _
    (ByVal hMenu As Long, ByVal nPos As Long) As Long
Private Declare Function SetMenuItemBitmaps Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, _
    ByVal hBitmapUnchecked As Long, ByVal hBitmapChecked As Long) As Long

Const MF_BYPOSITION = &H400&
Private Sub Form_Load()
    Dim hMenu As Long
    Dim hSubMenu As Long
    
    Set PictureClip1.Picture = LoadPicture("d:\temp\bitmap.bmp")
    PictureClip1.Cols = 10
    
    hMenu = GetMenu(hwnd)
    hSubMenu = GetSubMenu(hMenu, 0)
    SetMenuItemBitmaps hSubMenu, 0, MF_BYPOSITION, PictureClip1.GraphicCell(0), 0
    SetMenuItemBitmaps hSubMenu, 1, MF_BYPOSITION, PictureClip1.GraphicCell(1), PictureClip1.GraphicCell(3)
    hSubMenu = GetSubMenu(hMenu, 1)
    SetMenuItemBitmaps hSubMenu, 0, MF_BYPOSITION, PictureClip1.GraphicCell(2), 0
End Sub

Open in new window

0
 
LVL 11

Expert Comment

by:louisfr
ID: 41905442
I think my reply answers the question.
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question