[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Menus' (#lcl)

# TMenuItem.DoDrawItem

Performs actions needed to draw the menu item to the specified Canvas.

## Declaration

Source position: menus.pp line 231

`protected function TMenuItem.DoDrawItem(`
`ACanvas: TCanvas;`
`ARect: TRect;`
`AState: TOwnerDrawState`
`):Boolean; virtual;`

## Arguments

`ACanvas` |  | Canvas where the menu item is drawn.
`ARect` |  | Display rectangle for the menu item.
`AState` |  | Owner-draw state for the menu item.

## Function result

True if the menu item was rendered using an OnDrawItem event handler.

## Description

DoDrawItem is a Boolean function which performs actions needed to draw the menu item to the specified canvas with the given owner-drawn state.

DoDrawItem signals the OnDrawItem event handler (when assigned) to render the menu item to the canvas specified in ACanvas using the arguments passed to the method. The return value is set to True when the drawing operation is completed.

If OnDrawItem has not been assigned in the menu item, the GetParentMenu method is called to get the TMenu instance where the menu item is located. Its OnDrawItem event handler is signalled (when assigned) to render the menu item to the canvas specified in ACanvas using the arguments passed to the method. The return value is set to True when the drawing operation is completed.

If neither OnDrawItem event handler has been assigned, no actions are performed in the method and the return value is set to False.