|
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Drawing.Drawing2D;
using System.Diagnostics;
using System.Globalization;
namespace GraphComponents
{
/// <summary>
/// Summary description for Cursor.
/// </summary>
class Cursor : IGraphElement
{
private Rectangle graphArea;
private Channel channel;
public Rectangle GraphArea
{
get { return graphArea; }
set { graphArea = value; }
}
public Cursor(Channel channel)
{
this.channel = channel;
}
#region IGraphElement Members
public void Draw(Graphics graphics)
{
// TODO: Add Cursor.Draw implementation
int halfGraphHeight = GraphArea.Height / 2;
float range = channel.MaximumValue - channel.MinimumValue;
int offsetInPixel = (int) ((float) (GraphArea.Height / range) * channel.CursorOffset);
Point leftPoint = new Point ();
leftPoint.X = GraphArea.Left;
leftPoint.Y = GraphArea.Bottom - halfGraphHeight + offsetInPixel;
Point rightPoint = new Point (GraphArea.Right, leftPoint.Y);
graphics.DrawLine (new Pen (channel.ChannelColor), leftPoint, rightPoint);
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.