public class termo { System.Drawing.Graphics zona_des; int x0; int y0; int w; int h; double val_max; double val_min; public void desenez(System.Drawing.Color culoare_contur, System.Drawing.Color culoare_valori) { System.Drawing.Pen creion_a = new System.Drawing.Pen(culoare_contur); System.Drawing.Pen creion_gr = new System.Drawing.Pen(Color.Gray); System.Drawing.SolidBrush pens_gr = new System.Drawing.SolidBrush(culoare_valori); System.Drawing.Font font_ni = new System.Drawing.Font("Nina", 8); zona_des.DrawRectangle(creion_a, x0, y0, w, h); for (int j = 0; j <= h; j += 5)// desenez gradatii { if (j % 25 == 0) { zona_des.DrawLine(creion_gr, x0 + w + 2, y0 + j, x0 + w + 12, y0 + j); zona_des.DrawString(System.Convert.ToString(Math.Round((val_max - j * (val_max - val_min) / h),2)), font_ni, pens_gr, x0 + w + 20, y0 + j - 7); } else { zona_des.DrawLine(creion_gr, x0 + w + 2, y0 + j, x0 + w + 7, y0 + j); } } } public void setval(double val, System.Drawing.Color culoare_afisare, System.Drawing.Color culoare_radiera) { System.Drawing.SolidBrush pens_r = new System.Drawing.SolidBrush(culoare_afisare); System.Drawing.SolidBrush rad = new System.Drawing.SolidBrush(culoare_radiera); zona_des.FillRectangle(rad, x0 + 1, y0 + 1, w - 1, h - 1); if (val > val_max) val = val_max; if (val < val_min) val = val_min; val =(val - val_min) * (System.Convert.ToDouble(h) / (val_max - val_min)); //scalare zona_des.FillRectangle(pens_r, x0 + 1, y0 + h - System.Convert.ToInt32(val), w - 1, System.Convert.ToInt32(val)); } public termo(System.Drawing.Graphics desen, int pozx, int pozy, int lat, int inalt, double vmin, double vmax) { zona_des = desen; x0 = pozx; y0 = pozy; w = lat; h = inalt; val_max = vmax; val_min = vmin; } }