public override void CPDrawGrid (Graphics graphics, Rectangle area, Size pixelsBetweenDots, Color backColor) {
Color foreColor;
int h;
int b;
int s;
ControlPaint.Color2HBS(backColor, out h, out b, out s);
if (b>127) {
foreColor=Color.Black;
} else {
foreColor=Color.White;
}
// still not perfect. it seems that ms calculates the position of the first dot or line
using (Pen pen = new Pen (foreColor)) {
pen.DashPattern = new float [] {1.0f, pixelsBetweenDots.Width - 1};
for (int y = area.Top; y < area.Bottom; y += pixelsBetweenDots.Height)
graphics.DrawLine (pen, area.X, y, area.Right - 1, y);
}
}