Retrieves or sets the image associated with the item menu
Type | Description | |||
Long | A long expression that indicates the image associated with the item menu. |
Use Images method of the control to associate at runtime an images list to your popup menu. Use the Image property of the Command to change the image. Use the Image() = -1 to remove the item's image.
The following sample shows how to use your own images to simulate a check box item ( add two images to control's images list at the top of the list in the following order )
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If (Button = 2) Then ' Adds a new item to menu with the identifier 1234 Dim it As Item Set it = PopupMenu1.Items.Item("Auto saving") If it Is Nothing Then Set it = PopupMenu1.Items.Add("Auto saving", Default, 1234) it.Image = 0 End If ' Displays the context menu Dim nID As Long nID = PopupMenu1.ShowAtCursor ' Changes the item's image if the user has selected the 1234 command menu If nID = 1234 Then it.Image = (it.Image + 1) Mod 2 End If End If End Sub