VLMenuPlus Reference

EventDrawMenuItem

See Also See Also Applies To Applies To

This event occurs when a menu item needs to be drawn. This is an advanced event and you will not need to handle it unless you want to paint the menu item in your own way.

 

Syntax

Private Sub object _DrawMenuItem( ByVal mnuItem As CMenuItem, _
ByVal menuDC As Long, _
ByVal bSelected As Boolean, _
ByVal CX As Long, ByVal CY As Long, _
ByRef bUserDrawn As Boolean)

 

The DrawMenuItem event syntax has these parts:

Part Description
object An object expression that evaluates to an object of VLMenuPlus type.
mnuItem A CMenuItem object corresponding to the menuitem that needs to be drawn. For details refer to CMenuItem documentation.
menuDC Handle of the device context on which menu item is being drawn.
bSelected boolean parameter indicating if the menuitem is currently selected (i.e. to be drawn as highlighted).
CX Width of the menu item in pixels.
CY Height of the menu item in pixel.
bUserDrawn Parameter used to indicate to the control if menu item will be drawn by the user. It should be set True for the menu items that will be custom painted.

 

Remark

If you are handling this event, you must set bUserdrawn to true, otherwise control will automatically handle the drawing of the menuitem.

Please make sure that your menuitem painting does not go outside the rectangle (0, 0, CX, CY).  As the menuDC does not clip, painting outside the specified area may overwrite the other menu items.

Also, you might need to handle SetMenuItemSize event to specify the size requirements as per your menu item painting.