Suman Raj

Suman Raj

  • NA
  • 287
  • 13.5k

Create Isocandella according to gridsize in picturebox

Nov 4 2018 11:53 PM
//Initial
private double[,] HaloData = { { 1, 1 }, { 1, 2 }, { 1, 3 } };//2 dimensional array
private Size size = new Size(800, 200);
Graphics g;
Bitmap graph;

public Isocandella()
{
InitializeComponent();
pictureBoxIsocandella.Image = new Bitmap(pictureBoxIsocandella.Width, pictureBoxIsocandella.Height);
g = Graphics.FromImage(pictureBoxIsocandella.Image);
}
public image(double[,] data)
{
this.HaloData = data;
this.FunctionName =Function;
}
//load
private void Isocandella_Load(object sender, EventArgs e)
{
DrawHalo(min, max);
DrawGrid(); 
}
private void DrawGrid()
{
Pen linePen = new Pen(System.Drawing.Color.CornflowerBlue);
g.Clear(this.BackColor);
for (int i = 1; i < 21; i++)
{
//Draw verticle line
g.DrawLine(linePen,
(this.ClientSize.Width / 20) * i,
0,
(this.ClientSize.Width / 20) * i,
this.ClientSize.Height);
//Draw horizontal line
g.DrawLine(linePen,
0,
(this.ClientSize.Height / 10) * i,
this.ClientSize.Width,
(this.ClientSize.Height / 10) * i);
}
linePen.Dispose();
private void DrawHalo(double min, double max)
{
ColorScale cs = new ColorScale(min, max);
for (int i = 0; i < 3; i++)//how to give array row and coloumn size after < get automatically
{
for (int j = 0; j < 3; j++)
{
Color c = cs.getColor(HaloData[i,j]);
graph.SetPixel((int)HaloData[i,0],(int)HaloData[j,0],Color.Purple);
}
}
 
 Solve this for me