kardsen 9 Newbie Poster

I am having trouble figuring out how to pull this off.

Basically I have a gridview table that shows a point value in each cell. What I am attempting to do is replace the point value within the cell and draw a colorized circle/dot where the color is based upon the point value.

So I have my Form1_Paint as

Protected Sub Form1_Paint(ByVal sender As Object, ByVal e As PaintEventArgs)

        Dim g As Graphics = e.Graphics
        Dim mypen As New Pen(Color.Black, 5)
        Dim mybrush As New SolidBrush(Color.Green)

        g.FillEllipse(mybrush, 10, 100, 75, 50)
        g.DrawEllipse(mypen, 10, 100, 75, 50)
    End Sub

Then within the GridView1_RowDataBound event I have

Sub GridView1_RowDataBound(ByVal Sender As Object, ByVal e As GridViewRowEventArgs)
       If e.Row.RowType = DataControlRowType.DataRow Then
            For columnIndex As Integer = 1 To e.Row.Cells.Count - 1
                Try
                    Dim CellText = e.Row.Cells(columnIndex).Text
                    If CellText = " " Then
                        'MsgBox("green button")
                    ElseIf CellText > -1 Then
                        'MsgBox("green button")
                    ElseIf CellText < -1 And CellText > -5 Then
                        'MsgBox("gold button")
                    ElseIf CellText < -5 Then
                        'MsgBox("red button")
                    End If
                Catch ex As Exception
                End Try
            Next
        End If
    End Sub

How do I call the Form1_Paint sub within the gridview to draw the image?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.