1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48:
| private void panel1_Paint(object sender, PaintEventArgs e) { Panel p = (Panel)sender; Graphics g = e.Graphics; int pCount = points.Count;
int PanelHeight = p.Height; int PanelWidth = p.Width; int ClientHeight = p.ClientRectangle.Height; int ClientWidth = p.ClientRectangle.Width; float ClipHeight = g.ClipBounds.Height; float ClipWidth = g.ClipBounds.Width; int eClipLeft = e.ClipRectangle.Left; int eClipRight = e.ClipRectangle.Right; Point asPosition = p.AutoScrollPosition;
int xBegin; int xEnd; xBegin = - asPosition.X + 1; xEnd = eClipRight > pCount ? pCount : eClipRight;
GraphicsPath gp = new GraphicsPath(); for (int x = 1; x < xEnd; x++) { gp.AddLine(x - 1, points[xBegin - 1] * yScale * mAmpScale, x, points[xBegin] * yScale * mAmpScale); if ((xBegin % 100) == 0) { g.DrawString(xBegin.ToString(), pFont, bECG, (float)x, 10.0f); } xBegin++; } g.DrawPath(pECG, gp); p.AutoScrollMinSize = new Size(pCount , PanelHeight);
if (bScroll) { p.AutoScrollPosition = new Point(pCount - p.Width, p.AutoScrollPosition.Y); } } |