//handles the visual of the hash table's elements on the panel pnlDraw private void pnlDraw_Paint(object sender, PaintEventArgs e) { //only draw if ready if (my_hash_set != null) { Internals.getHashSetInternals <Cloneable>(my_hash_set, ref my_data); //get a graphics context to draw with Graphics g = e.Graphics; int row_count = my_data.Length / 5; //number of elements per row int col_width = (pnlDraw.Width - 20) / 5; // width of each coloum of elements double delta = (pnlDraw.Height * 1.0) / row_count; //get the distance between elements and draw them //loop through all elements and draw them for (int i = 0; i < my_data.Length; i++) { int col = i / row_count; //current column int left = 4 + col * 4 + col * col_width; //left x value for the line being drawn int right = left + col_width; //right x value for the line being drawn //draw the line Pen p = new Pen(new SolidBrush(Color.Black)); if (my_data[i] != null) { int y = (int)(delta * (i % row_count)); g.DrawLine(p, new Point(left, y), new Point(right, y)); } } //setup visual labels for row counts setupItemLabels(my_data.Length); } }