private void afis_7seg(Graphics desen, int px0, int py0, int dig_w, int dig) { System.Drawing.Pen cr_verde, cr_gri; cr_verde = new System.Drawing.Pen(System.Drawing.Color.Red, dig_w/4); cr_gri = new System.Drawing.Pen(System.Drawing.Color.WhiteSmoke, dig_w/4); UInt16[] digit = new UInt16[10] {123,40,93,109,46,103,119,41,127,111}; int[] px = new int[7] { px0, px0, px0, px0 + dig_w, px0, px0 + dig_w, px0 }; int[] px_f = new int[7] { px0 + dig_w, px0, px0 + dig_w, px0 + dig_w, px0, px0 + dig_w, px0 + dig_w}; int[] py = new int[7] { py0, py0, py0 + dig_w, py0, py0 + dig_w, py0 + dig_w, py0 + 2 * dig_w }; int[] py_f = new int[7] { py0, py0 + dig_w, py0 + dig_w, py0 + dig_w, py0 + 2 * dig_w, py0 + 2 * dig_w, py0 + 2 * dig_w }; UInt16 nr = digit[dig]; int i; // sterg digit for (i = 6; i >= 0; i--) desen.DrawLine(cr_gri, px[i], py[i], px_f[i], py_f[i]); for (i = 6; i >= 0; i--) { UInt16 bit = Convert.ToUInt16((nr >> (i)) & 1); if (bit == 1) desen.DrawLine(cr_verde,px[i],py[i],px_f[i],py_f[i]) ; } }