Sample Applications Written in C#
See :
Samples in VB .NET
Samples can be written in any language that supports the CLR (Common Language
Runtime) of the .NET Compact Framework
LineGraph Sample in C#
/*************************************************************
*
* This program demonstrates the use of LineGraph component of the MicroGraphs
*
* Product Of : MakeLogic
* URL : http://www.makelogic.com
* Author : Madanu Ujjwal Kumar
* Date : 10 November, 2002
* Last Modified : 15 October, 2007
* email : madanuuk@makelogic.com AND madanuuk2@yahoo.com
*
*
***************************************************************/
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using MakeLogic.MG;
namespace LineGraphDemo
{
public class LineGraphDemo : System.Windows.Forms.Form
{
private LineGraph lineGraph;
private Random random;
private double[] xValues;
private double[] yValues;
private int size = 15;
public LineGraphDemo()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
////
//MAKELOGIC Code
xValues = new double[size];
yValues = new double[size];
random = new Random();
for(int i=0;i<size;i++)
{
xValues[i] = i;//(int)(random.NextDouble()*30);
yValues[i] = (int)(random.NextDouble()*(30));
}
try
{
lineGraph = new LineGraph(xValues,yValues,this.Width,this.Height);
}
catch(IncompatibleDataException e)
{
MessageBox.Show(e.Message,"MicroGraphs");
Application.Exit();
}
catch(Exception e)
{
MessageBox.Show(e.Message,"MicroGraphs");
Application.Exit();
}
/***********************************************************************
*
* Method - Testing
* 1. Following code tests the various functions in LineGraph component
*
* *********************************************************************/
//Target Lines
lineGraph.addTargetLineAt(10);
lineGraph.addTargetLineAt(15);
lineGraph.TargetLinesColor = Color.Red;
//lineGraph.TargetLinesOn = false;
//Compare lines
int compareSets = 1;
int j=0;
while(j++<compareSets)
{
double[] compareValues = new double[size];
for(int i=0;i<size;i++)
{
compareValues[i] =25*j+ (int)(random.NextDouble()*(30));
}
lineGraph.CompareLines(compareValues,"Data Set : "+j);
}
/*************************************************************
*
* Properties - Testing
* 1. The following code helps in testing the various properties supported by the
LineGraph
* 2. Uncomment one line at a time, recompile and run it to see the results
*
*
*********************************************************/
//lineGraph.AxesColor = Color.Red;
//lineGraph.BorderColor = Color.Red;
//lineGraph.BorderOn = false;
//lineGraph.DropLinesColor = Color.Red;
//lineGraph.EventsButtonSize = 20;
//lineGraph.EventsEnabled = false;
//lineGraph.LabelsFontSize = 12;
//lineGraph.LineColor = Color.Red;
//lineGraph.MainLineLabel = "MakeLogic";
//lineGraph.NodalValuesFontSize = 16;
//lineGraph.NodeColor = Color.Violet;
//lineGraph.NodeSize = 10;
//lineGraph.NodesOn = false;
//lineGraph.SelectedNodalValueColor = Color.SaddleBrown;
//lineGraph.ShowLabelForTheSelectedLine = false;
//lineGraph.ShowXDropLineForTheSelectedNode = false;
//lineGraph.ShowYDropLineForTheSelectedNode = false;
//lineGraph.Title = "MakeLogic";
//lineGraph.TitleFontSize = 14;
//lineGraph.TitleOn = false ;
//lineGraph.ValuesFontSize = 10;
//lineGraph.XAxisOn = false ;
//lineGraph.XGrid = 3;
//lineGraph.XGridColor = Color.Red;
//lineGraph.XGridOn = false;
//lineGraph.XLabelOn = false ;
//lineGraph.XShift = 30;
//lineGraph.YAxisOn = false;
//lineGraph.YGridColor = Color.Red;
//lineGraph.YGridOn = false;
//lineGraph.YLabelOn = false;
//lineGraph.YShift = -30;
this.Controls.Add(lineGraph);
}
//Destructor
~LineGraphDemo()
{
MessageBox.Show("Destroying","LineGraphDemo");
Dispose(false);
Application.Exit();
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Text = "LineGraphDemo - MakeLogic";
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
LineGraphDemo lgd = new LineGraphDemo();
Application.Run(lgd);
}
}
}



