void OnPaint(PaintEventArgsI e) { xline = (this.Width - 1) / (float)xdist; yline = (this.Height - 1) / (float)ydist; var pen = new Pen(Color.Silver); pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash; if (BGImage != null) { e.Graphics.DrawImage(BGImage, BGImagex * xline, BGImagey * yline, BGImagew * xline, BGImageh * yline); } //lines for (float x = 0; x <= xdist; x++) { // middle if (x == xdist / 2) { } else if (x % 2 == 0) { e.Graphics.DrawLine(Pens.Silver, x * xline, 0, x * xline, this.Height); } else { e.Graphics.DrawLine(pen, x * xline, 0, x * xline, this.Height); } } for (float y = 0; y <= ydist; y++) { // middle if (y == ydist / 2.0f) { } else if (y % 2 == 0) { e.Graphics.DrawLine(Pens.Silver, 0, y * yline, this.Width, y * yline); } else { e.Graphics.DrawLine(pen, 0, y * yline, this.Width, y * yline); } } // draw the middle lines e.Graphics.DrawLine(Pens.Green, xdist / 2 * xline, 0, xdist / 2 * xline, this.Height); e.Graphics.DrawLine(Pens.Green, 0, ydist / 2 * yline, this.Width, ydist / 2 * yline); //text for (float x = 1; x <= xdist; x++) { if (x % 2 == 0) { e.Graphics.DrawString(((xdist / -2) + x + centerx).ToString("0.0"), SystemFonts.DefaultFont, Brushes.Red, x * xline, 0.0f, StringFormat.GenericDefault); } } for (float y = 0; y <= ydist; y++) { if (y % 2 == 0) { e.Graphics.DrawString((((ydist / -2) + y - centery) * -1).ToString("0.0"), SystemFonts.DefaultFont, Brushes.Red, 0.0f, y * yline, StringFormat.GenericDefault); } } //icons foreach (icon ico in icons) { //if (ico.interf.parent.BaseStream.IsOpen) { if (Vertical) { ico.OnPaintVertical(e, xdist, ydist, this.Width, this.Height, centerx, centery); } else { ico.OnPaint(e, xdist, ydist, this.Width, this.Height, centerx, centery); } } } // if (mouseover != null) { mouseover.MouseOver(e); } }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); xline = (this.Width - 1) / (float)xdist; yline = (this.Height - 1) / (float)ydist; //lines for (float x = 0; x <= xdist; x++) { // middle if (x == xdist / 2) { } else { e.Graphics.DrawLine(Pens.Silver, x * xline, 0, x * xline, this.Height); } } for (float y = 0; y <= ydist; y++) { // middle if (y == ydist / 2.0f) { } else { e.Graphics.DrawLine(Pens.Silver, 0, y * yline, this.Width, y * yline); } } // draw the middle lines e.Graphics.DrawLine(Pens.Green, xdist / 2 * xline, 0, xdist / 2 * xline, this.Height); e.Graphics.DrawLine(Pens.Green, 0, ydist / 2 * yline, this.Width, ydist / 2 * yline); //text for (float x = 1; x <= xdist; x++) { if (x % 2 == 0) { e.Graphics.DrawString(((xdist / -2) + x).ToString(), SystemFonts.DefaultFont, Brushes.Red, x * xline, 0.0f, StringFormat.GenericDefault); } } for (float y = 0; y <= ydist; y++) { if (y % 2 == 0) { e.Graphics.DrawString((((ydist / -2) + y) * -1).ToString(), SystemFonts.DefaultFont, Brushes.Red, 0.0f, y * yline, StringFormat.GenericDefault); } } //icons foreach (icon ico in icons) { if (ico.interf.BaseStream.IsOpen) { if (Vertical) { ico.OnPaintVertical(e, xdist, ydist, this.Width, this.Height); } else { ico.OnPaint(e, xdist, ydist, this.Width, this.Height); } } } // if (mouseover != null) { mouseover.MouseOver(e); } }