public class matrix { 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 nrb; // numarul de biti (coloane) int dc; // dreptunghi d_c=1, cerc d_c=0) int rv; // rosu r_v=1, verde r_v=0) public void setval(Int64[] n) { int x = x0 + nrb*(wb+4)-wb; int y = y0 + hb; int i, j; if(rv==1) pens_v = pens_r; //des.DrawRectangle(creion_gr, x0, y0, (wb+4)*nrb+wb, (hb+4) *nrr+hb); for (j = 0; j < nrr; j++) { for (i = nrb - 1; i >= 0; i--) { System.Int64 bit = ((n[j] >> (nrb - i - 1)) & 1); if (dc == 1) { des.DrawRectangle(creion_gr, x - 1, y - 1, wb + 1, hb + 1); if (bit == 1) 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 (bit == 1) des.FillEllipse(pens_v, x, y, wb, hb); else des.FillEllipse(pens_gri, x, y, wb, hb); } x -= wb+4; } x = x0 + nrb * (wb+4)-wb; y += hb+4; } } public matrix(System.Drawing.Graphics desen, int pozx, int pozy, int bit_w, int bit_h, int nr_randuri, int nr_biti, 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 nrb = nr_biti; // numarul de biti (coloane) dc = d_c; // dreptunghi d_c=1, cerc d_c=0) rv = r_v; // rosu r_v=1, verde r_v=0) } }