Solved

Creating a png/bitmap image with collection of icons

Posted on 2016-11-07
4
46 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

729 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