class_docstr: A controller for the BinaryMatrix setting
      
class_docstr_tok: ["A","controller","for","the","BinaryMatrix","setting"]
code: def on_matrix_ctrl_paint(self, event):
      paint_dc = wx.BufferedPaintDC(self.matrix_ctrl)
      matrix = self.setting.get_matrix()
      h = len(matrix)
      w = len(matrix[0])
      bx, ex, dx, by, ey, dy = [
          wx.SystemSettings.GetMetric(m)
          for m in (
              wx.SYS_BORDER_X,
              wx.SYS_EDGE_X,
              wx.SYS_SMALLICON_X,
              wx.SYS_BORDER_Y,
              wx.SYS_EDGE_Y,
              wx.SYS_SMALLICON_Y,
          )
      ]
      paint_dc.SetBackground(wx.Brush(get_background_color()))
      paint_dc.Clear()
      pShadow = wx.Pen(
          wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNSHADOW),
          1,
          wx.PENSTYLE_SOLID,
      )
      pHighlight = wx.Pen(
          wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNHIGHLIGHT),
          1,
          wx.PENSTYLE_SOLID,
      )
      bBackground, bForeground = [
          wx.Brush(color)
          for color in (wx.Colour(80, 80, 80, 255), wx.WHITE)
      ]
      rw = 2 * ex + dx
      rh = 2 * ey + dy
      for x in range(w):
          for y in range(h):
              rx = x * rw + x * bx
              ry = y * rh + y * by
              value = matrix[y][x]
              paint_dc.SetPen(pHighlight if value else pShadow)
              for k in range(ex):
                  paint_dc.DrawLine(
                      rx + k, ry + k, rx + rw - k - 1, ry + k
                  )
                  paint_dc.DrawLine(
                      rx + k, ry + k, rx + k, ry + rh - k - 1
                  )
              paint_dc.SetPen(pShadow if value else pHighlight)
              for k in range(ex):
                  paint_dc.DrawLine(
                      rx + k,
                      ry + rh - k - 1,
                      rx + rw - k - 1,
                      ry + rh - k - 1,
                  )
                  paint_dc.DrawLine(
                      rx + rw - k - 1,
                      ry + k,
                      rx + rw - k - 1,
                      ry + rh - k - 1,
                  )
              paint_dc.SetPen(wx.TRANSPARENT_PEN)
              paint_dc.SetBrush(bForeground if value else bBackground)
              paint_dc.DrawRectangle(rx + ex, ry + ey, dx, dy)
      event.Skip()
  
file_path: CellProfiler/src/frontend/cellprofiler/gui/module_view/_binary_matrix_controller.py
imports: import wx
  from cellprofiler_core.preferences import get_background_color
  from cellprofiler_core.setting import BinaryMatrix
  from ._module_view import ModuleView
  from ..utilities.module_view import edit_control_name
label_desc: Use image node_id 4 for calling the BinaryMatrixController obj's underlying member method code with example usage: obj.on_matrix_ctrl_paint(event) without return types