public class matrix_b { System.Drawing.Graphics des; System.Drawing.Pen creion_gr = new System.Drawing.Pen(System.Drawing.Color.Gray); System.Drawing.SolidBrush pens_r = new System.Drawing.SolidBrush(System.Drawing.Color.Red); System.Drawing.SolidBrush pens_v = new System.Drawing.SolidBrush(System.Drawing.Color.Lime); System.Drawing.SolidBrush pens_gri = new System.Drawing.SolidBrush(System.Drawing.Color.LightGray); int x0; // pozitia pe x int y0; // pozitia pe y int wb; // latimea unui bit int hb; // inaltimea unui bit int nrr; // numarul de randuri int nrc; // numarul de coloane int dc; // dreptunghi d_c=1, cerc d_c=0) int rv; // rosu r_v=1, verde r_v=0) public void setval(bool[,] mat) { int x = x0 + nrc * (wb + 4) - wb; int y = y0 + hb; int i, j; if (rv == 1) pens_v = pens_r; for (j = 0; j < nrr; j++) { for (i = nrc - 1; i >= 0; i--) { if (dc == 1) { des.DrawRectangle(creion_gr, x - 1, y - 1, wb + 1, hb + 1); if (mat[j,i]) des.FillRectangle(pens_v, x, y, wb, hb); else des.FillRectangle(pens_gri, x, y, wb, hb); } if (dc == 0) { des.DrawEllipse(creion_gr, x - 1, y - 1, wb + 2, hb + 2); if (mat[j,i]) des.FillEllipse(pens_v, x, y, wb, hb); else des.FillEllipse(pens_gri, x, y, wb, hb); } x -= wb + 4; } x = x0 + nrc * (wb + 4) - wb; y += hb + 4; } } public matrix_b(System.Drawing.Graphics desen, int pozx, int pozy, int bit_w, int bit_h, int nr_randuri, int nr_coloane, int d_c, int r_v) { des = desen; x0 = pozx; // pozitia pe x y0 = pozy; // pozitia pe y wb = bit_w; // latimea unui bit hb = bit_h; // inaltimea unui bit nrr = nr_randuri; // numarul de randuri nrc = nr_coloane; // numarul de coloane dc = d_c; // dreptunghi d_c=1, cerc d_c=0) rv = r_v; // rosu r_v=1, verde r_v=0) } }