Oto cały kod tej klasy:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing;
namespace EBinder.CustomControls.Charts
{
public class LinearChart : Control
{
public Pen MyPen;
public static List<Point> points;
public int Maxvalue;
public int Minvalue;
public int zero = 0;
public LinearChart()
{
this.SuspendLayout();
}
public int MinValue
{
get { return Minvalue; }
set { Minvalue = value; }
}
public int MaxValue
{
get { return Maxvalue; }
set { Maxvalue = value; }
}
public List<Point> Points { get; set; }
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics g = e.Graphics;
MyPen = new Pen(Brushes.Black, 2);
g.DrawLine(MyPen, new Point(20, 50), new Point(20, Height - 20));// Oś Y
g.DrawLine(MyPen,new Point(25,65),new Point(20,50));//Strzałka Y
g.DrawLine(MyPen,new Point(14,65),new Point(20,50)); //Strzałka Y
g.DrawLine(MyPen, new Point(20, Height - 20), new Point(Width - 50, Height - 20)); //Oś X
g.DrawLine(MyPen,new Point(Width - 50,Height - 20),new Point(Width - 65,Height - 5));//Strzałka X
g.DrawLine(MyPen, new Point(Width - 50, Height - 20), new Point(Width - 65, Height - 35));//Strzałka X
g.DrawString(this.Text,new Font("Segoe UI",12),Brushes.Black,new PointF(Width/2 - 5 - 45,5)); // Tytuł Wykresu
g.Dispose();
}
}
}