VB : menu popup : petite image à gauche ???

VB : menu popup : petite image à gauche ??? - Programmation

Marsh Posté le 05-04-2001 à 12:50:46    

Comment insérer une petite icone devant le texte des menus ??? (par exemple la petite image de l'imprimante en face de imprimer ...)

Reply

Marsh Posté le 05-04-2001 à 12:50:46   

Reply

Marsh Posté le 05-04-2001 à 13:37:53    

Normalement tu dois employer les API Windows...
 
http://www.vbfrance.com/article.asp?Val=429

Reply

Marsh Posté le 05-04-2001 à 13:40:53    

Je vais étudié ca de plus près ...
Merci bien

Reply

Marsh Posté le 05-04-2001 à 14:57:51    

Si tu veux juste mettre des images :
 
une form avec un menu et un élément, une picturebox (picture1)
 
Const MF_BYPOSITION = &H400&
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
Private Sub Form_Load()
    Dim hMenu As Long, hSubMenu As Long
    'get the handle of the menu
    hMenu = GetMenu(Me.hwnd)
    'check if there's a menu
    If hMenu = 0 Then
        MsgBox "This form doesn't have a menu!"
        Exit Sub
    End If
    'get the first submenu
    hSubMenu = GetSubMenu(hMenu, 0)
    'check if there's a submenu
    If hSubMenu = 0 Then
        MsgBox "This form doesn't have a submenu!"
        Exit Sub
    End If
    'set the menu bitmap
    SetMenuItemBitmaps hSubMenu, 0, MF_BYPOSITION, Picture1.Picture, Picture1.Picture
End Sub

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed