---
title: "drawBorderAndBackground(withFrame:in:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsmenuitemcell/drawborderandbackground(withframe:in:)"
---

# drawBorderAndBackground(withFrame:in:)

Draws the borders and background associated with the receiver’s menu item (if any).

## Declaration

```swift
func drawBorderAndBackground(withFrame cellFrame: NSRect, in controlView: NSView)
```

## Parameters

- `cellFrame`: A rectangle defining the receiver’s frame area.
- `controlView`: The view object that contains this cell (usually an doc://com.apple.appkit/documentation/AppKit/NSControl object).

## Discussion

Discussion This method invokes the NSCell method imageRect(forBounds:), passing it cellFrame, to calculate the rectangle in which to draw the image. The cell invokes this method before invoking the methods to draw the other menu item components.

## See Also

### Related Documentation

- [draw(withFrame:in:)](appkit/nscell/draw(withframe:in:).md)

### Drawing the Menu Item

- [drawImage(withFrame:in:)](appkit/nsmenuitemcell/drawimage(withframe:in:).md)
- [drawKeyEquivalent(withFrame:in:)](appkit/nsmenuitemcell/drawkeyequivalent(withframe:in:).md)
- [drawSeparatorItem(withFrame:in:)](appkit/nsmenuitemcell/drawseparatoritem(withframe:in:).md)
- [drawStateImage(withFrame:in:)](appkit/nsmenuitemcell/drawstateimage(withframe:in:).md)
- [drawTitle(withFrame:in:)](appkit/nsmenuitemcell/drawtitle(withframe:in:).md)
- [needsDisplay](appkit/nsmenuitemcell/needsdisplay.md)
