mustoora 0 Newbie Poster

Hi there.

Sorry, realized that my previous post has some typo error. Editted. Hope can seek some help.
I am trying to make a certain symbol to appear upon every mouseclick. However, the symbol is a cross and an arrow head. This is how I tried to do it.

Private Sub Form1_Paint(ByVal sender As Object, ByVal e As _
     System.Windows.Forms.PaintEventArgs) Handles _
     MyBase.Paint

        Dim bluePen As New Pen(Color.Blue, 1.5)
        Dim G As Graphics = e.Graphics

        For Each p As Point In mypts
            G.DrawLine(bluePen, (p.X - 5), (p.Y - 5), (p.X + 5), (p.Y + 5))
            G.DrawLine(bluePen, (p.X + 5), (p.Y - 5), (p.X - 5), (p.Y + 5))
            Dim end_path As New Drawing2D.GraphicsPath
            end_path.AddLine(0, 0, -4, -4)
            end_path.AddLine(0, 0, 4, -4)
            Dim end_cap As New Drawing2D.CustomLineCap(Nothing, end_path)
            bluePen.CustomEndCap = end_cap
            G.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
            G.DrawLine(bluePen, (p.X - 4), p.Y, (p.X - 12), (p.Y + 7))
            end_path.Dispose()
            end_cap.Dispose()
        Next
    End Sub

    Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
        Me.mypts.Add(New Point(e.X, e.Y))
        Me.Invalidate()
    End Sub

However, the problem is, even the lines now suppose to have the arrow heads are having the end cap after the second click onwards. Advice please.

Thanks.

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.