How to show Grid in DicomViewer

Perhaps we might have done this internally and make a new DicomViewer 'ShowGrid' property. But that way the end users may loose some flexibilities in setting the grid style (width, color etc.etc.). For now if you would like to show the rows/columns grid before loading up any image, you can do so using the following VB code (or translate it into something else that you are using) :

Dim i, x, y As Integer

For i = 1 To DicomViewer1.MultiRows - 1
  Dim row As New DicomObjects.DicomLabel
  row.LabelType = DicomObjects.Enums.LabelType.Line
  row.ScaleMode = DicomObjects.Enums.ScaleMode.Cell1000
  row.Pen = New Pen(Color.White, 3)
  y = (1000 / (DicomViewer1.MultiRows)) * i
  row.Area = New RectangleF(0, y, 1000, 0)
  DicomViewer1.Labels.Add(row)
Next

For i = 1 To DicomViewer1.MultiColumns- 1
  Dim col As New DicomObjects.DicomLabel
  col.LabelType = DicomObjects.Enums.LabelType.Line
  col.ScaleMode = DicomObjects.Enums.ScaleMode.Cell1000
  col.Pen = New Pen(Color.White, 3)
  y = (1000 / (DicomViewer1.MultiColumns)) * i
  col.Area = New RectangleF(x, 0, 0, 1000)
  DicomViewer1.Labels.Add(col)
Next
Relevance: