示例#1
0
文件: Plotter.cs 项目: bbriggs/wesay
		/// <summary>
		/// Creates a plotter graph component. The default has 4 channels with 2 enabled
		/// and 2 disabled. The default ranges and channel names are also provided for
		/// all the 4 channels
		/// </summary>
		public Plotter()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			// TODO: Add any initialization after the InitComponent call
			channelCollection = new ChannelCollection();
			Channels.Add(new Channel(0, 100, "Voltage", true, Color.Blue));
			Channels.Add(new Channel(0, 5, "Current", true, Color.Red));
			Channels.Add(new Channel(0, 100, "2", false, Color.Green));
			Channels.Add(new Channel(0, 100, "3", false, Color.Purple));

			gridline = new Gridline(this);
			axisLineXandY = new AxisLine(this);

			SetStyle(
					ControlStyles.DoubleBuffer | ControlStyles.UserPaint |
					ControlStyles.AllPaintingInWmPaint,
					true);
			UpdateStyles();

			PlotRate = 300;
			initialPlotRate = PlotRate;

			GraphArea = new Rectangle(ClientRectangle.Left + graphMarginLeft,
									  ClientRectangle.Top + graphMarginTop,
									  ClientRectangle.Width - graphMarginRight - graphMarginLeft,
									  ClientRectangle.Height - graphMarginBottom - graphMarginTop);

			Debug.Assert(GraphArea.Height == (GraphArea.Bottom - GraphArea.Top), "Problem Ctor");

			int xRangeInMs = (int) (xRange.Duration().Ticks / TimeSpan.TicksPerMillisecond);
			plotterHScrollBar.Maximum = xRangeInMs / PlotRate;
			plotterHScrollBar.Value = xRangeInMs / PlotRate;
			plotterHScrollBar.Visible = false;

			rightDisplayLimit = xRangeInMs - leftDisplayLimit;
			savedXRange = xRange;

			ValueFormat = "{0:F}";

			buttonWidth = buttonPrevChannel.Width;
			buttonHeight = buttonPrevChannel.Height;
		}
示例#2
0
		public static void CopyTo(ChannelCollection collection, Int32 index)
		{
			if (collection == null)
			{
				throw new ArgumentNullException("collection");
			}

			if (index < 0 || index >= collection.Count)
			{
				throw new ArgumentOutOfRangeException("index");
			}

			// TODO: Implement this later
			throw new InvalidOperationException();
		}