Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void Form1_Paint(object sender, PaintEventArgs e)
- {
- Graphics g = e.Graphics;
- Pen whitePen = new Pen(Color.White, 1);
- float height = 50.0f;
- float width = (float)(4 * (height / 2 / Math.Sqrt(3)));
- float y = height / 2;
- float x = 0;
- float row = 0.0f;
- y += row * height;
- float col = 1.0f;
- if (col % 2 == 1)
- {
- y += height / 2;
- }
- x += col * (width * 0.75f);
- PointF pt1 = new PointF(x, y);
- PointF pt2 = new PointF(x + width * 0.25f, y - height / 2);
- PointF pt3 = new PointF(x + width * 0.75f, y - height / 2);
- PointF pt4 = new PointF(x + width, y);
- PointF pt5 = new PointF(x + width * 0.75f, y + height / 2);
- PointF pt6 = new PointF(x + width * 0.25f, y + height / 2);
- g.DrawLine(whitePen, pt1, pt2);
- g.DrawLine(whitePen, pt2, pt3);
- g.DrawLine(whitePen, pt3, pt4);
- g.DrawLine(whitePen, pt4, pt5);
- g.DrawLine(whitePen, pt5, pt6);
- g.DrawLine(whitePen, pt6, pt1);
- whitePen.Dispose();
- g.Dispose();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement