protected void HatchGrid(CGContext context)
{
var hatchSize = getHatchWidth (hatchStyle);
var lineWidth = getLineWidth (hatchStyle);
initializeContext(context, hatchSize, false);
/* draw background */
drawBackground (context, backColor, hatchSize, hatchSize);
/* draw lines in the foreground color */
context.SetStrokeColor(foreColor.ToCGColor());
context.SetLineWidth(lineWidth);
context.SetLineCap(CGLineCap.Square);
hatchSize -=HALF_PIXEL_X;
float yoffset = 0;
if (hatchStyle == HatchStyle.DottedGrid)
{
yoffset = 1;
nfloat[] dash = new nfloat[] { 1, 1};
context.SetLineDash(2,dash);
}
/* draw a horizontal line */
context.MoveTo(0,yoffset);
context.AddLineToPoint(0,hatchSize);
context.StrokePath();
/* draw a vertical line */
context.MoveTo(0,hatchSize);
context.AddLineToPoint(hatchSize, hatchSize);
context.StrokePath();
}