0

I'm drawing a 2d grid of hexagons using the DrawPolygon function. Works great, but I'm trying to figure out how to fill them with a certain color. It would appear the FillEllipse function is only meant for rectangles. Is there something I could use to fill shapes made with DrawPolygon? Please note, the below code includes a function I'm too lazy to include called CreateHex, which passes 2 coordinates (x and y of course) which it uses to calculate the 6 points which CreateHex uses to return the 6 points needed for the Hexagon. Here's my code:

    Dim myPen As New Pen(Color.Black)
    Dim PicGraphics As Graphics = Graphics.FromImage(bmp)
    Dim DrawFont As New Font("Arial", SizeSide / 3)
    Dim drawFormat As New StringFormat
    Dim drawBrush As New SolidBrush(Color.Black)
    For lc = 1 To ColNum
        For lc2 = 1 To RowNum
            PicGraphics.DrawPolygon(myPen, CreateHex(lc, lc2))
            PicGraphics.FillEllipse(New SolidBrush(Color.Red), CreateHex(lc, lc2)) ' <---- this doesn't work.
        Next
    Next

If I comment out the FillEllipse statement, it draws the polygons normally. But if its uncommented, it will draw nothing at all. Anyone know of a solution?

Kevin
  • 23
  • 5

0 Answers0