Results 1 to 6 of 6

Thread: Menu Bitmaps

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516

    Unhappy

    Hello. Thank you for listening to my problem:

    I've been adding bitmaps to the menus (trying to make the
    UI cover up the fact it's a pretty lame program) but there's
    a small problem. I've been using the bmps from the TlBr_W95
    folder, but they seem too big, you see the problem is they
    get 'clipped' on the left and bottom edges, so you can't see
    the full image. Since I would't expect good old Microsoft to
    make a mistake, I think it's my fault: But what am I doing
    wrong?

    Code:
    PS: Here's the code:
    
    Private Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function GetMenuItemID 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
    Private Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
    
    Sub CreateMenuBitMaps()
    Dim hMenu As Long, hSubMenu As Long, hMenuItemID As Long
    hMenu = GetMenu(frmWord.hwnd)
    hSubMenu = GetSubMenu(hMenu, 0)
    hMenuItemID = GetMenuItemID(hSubMenu, 0)
    SetMenuItemBitmaps hSubMenu, hMenuItemID, 0, frmWord.imglstMenu.ListImages(1).Picture, frmWord.imglstMenu.ListImages(1).Picture
    End Sub
    Also, does anybody know how to change the Menu's font or the Titlebar's font?

    I'm just trying to fit as many questions as possible here.


    [Edited by V(ery) Basic on 07-13-2000 at 02:52 PM]
    Courgettes.

  2. #2
    Guest
    This should help you out with the Bitmaps.

    Code:
    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 GetMenuItemID 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_BITMAP = &H4&
    
    Sub CreateMenuBitmaps()
    
        Dim hMenu As Long, hSub As Long, ItemID As Long
        hMenu = GetMenu(Me.hwnd)
        hSub = GetSubMenu(hMenu, 0)
        ItemID = GetMenuItemID(hSub, 0)
        SetMenuItemBitmaps hMenu, ItemID, MF_BITMAP, frmWord.imglstMenu.ListImages(1).Picture, frmWord.imglstMenu.ListImages(1).Picture
    
    End Sub
    
    Private Sub Form_Load()
    
        CreateMenuBitmaps
        
    End Sub

  3. #3
    Guest

    Wink If wanting to jaz up your interface how about icons

    Log onto http://www.vbaccelerator.com and download their free
    icon menu control. You can even get the source code to it.
    Remeber to also download the subtmr thingy.....they also have a great collect of windows icons.

    Just a thought, l had the same problems with bitmaps after downloading a project from this board. Solution was to use only 16x16 bitmaps.

    Prefer accelerators control though, it's pretty cool and impressive.

    Hope that is of some help

  4. #4
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242

    Talking

    I agree with Jethro. On vbaccelerator you can find a lot of useful controls (I almost allways use the ones from vbaccelerator.com instead of MS Common Controls).
    On cool example is also on www.planetsourcecode.com/vb
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516

    Talking Thank you

    Thanks.

    Yeah, I had looked at VB Accelerator, but VB was unable to 'initialise ActiveX component'
    so I decided I'd rather do it myself than look up what I'd done wrong on MSDN.

    Thank you for your help, and it now works.

    Courgettes.

  6. #6
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242
    When you download control you have to register it!!!
    First you have to copy it in Windows System directory and then you have to register it with regsvr32!!! You can do it likethat:
    regsvr32.exe <name of control or dll>

    And then you have to select it from controls list or from references list in VB
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width