public class histo { System.Drawing.Graphics zona_des; System.Drawing.SolidBrush rad = new System.Drawing.SolidBrush(Color.Black); int x0; int y0; int w; int h; double val_max,val_min; int nrv; public void setval(double[] vals, Color culoare_afisare, Color culoare_fundal) { System.Drawing.Pen creion = new System.Drawing.Pen(culoare_afisare, 4); System.Drawing.SolidBrush rad = new System.Drawing.SolidBrush(culoare_fundal); int val; // sterg zona_des.FillRectangle(rad, x0 + 1, y0 + 1, w + 10, h + 2); //desenez double factor_s=System.Convert.ToDouble(h) / (val_max - val_min); // factor de scala for (int i = 0; i < nrv; i++) { val = System.Convert.ToInt16((vals[i] - val_min) * factor_s); //scalare zona_des.DrawLine(creion, x0 + (i+1) * 10, y0+h+ Convert.ToInt16(val_min*factor_s), x0 + (i+1) * 10, y0 + h - val); } } public histo(System.Drawing.Graphics desen, int pozx, int pozy, int nr_valori, int inaltime, double vmin, double vmax) { nrv = nr_valori; zona_des = desen; x0 = pozx; y0 = pozy; w = nr_valori * 10; h = inaltime; val_max = vmax; val_min = vmin; } }