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 lose 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) :

DicomObjects.NET

   
	int i, x, y;
	for (i = 1; i <= Viewer.MultiRows - 1; i++)
	{
		DicomLabel row = new DicomLabel();
		row.LabelType = LabelType.Line;
		row.ScaleMode = ScaleMode.Cell1000;
		row.Pen = new Pen(Color.White, 3);
		y = (1000 / (Viewer.MultiRows)) * i;
		row.Area = new RectangleF(0, y, 1000, 0);
		Viewer.Labels.Add(row);
	}

	for (i = 1; i <= Viewer.MultiColumns - 1; i++)
	{
		DicomLabel col = new DicomLabel();
		col.LabelType = LabelType.Line;
		col.ScaleMode = ScaleMode.Cell1000;
		col.Pen = new Pen(Color.White, 3);
		x = (1000 / (Viewer.MultiColumns)) * i;
		col.Area = new RectangleF(x, 0, 0, 1000);
		Viewer.Labels.Add(col);
	}



We use cookies to give you the best possible experience on our website. By continuing to use this website, you agree with our use of cookies. for more information please click HERE