i have a panel in a form and a button. iwant to write a program that when i push the button,a circle
be drawn in panel but problem is here. because the handler in button is eventArgs but the panel
is paintEventArgs.
can someone give me a suggestion for doing this.
thanks in advance.

6 Years
Discussion Span
Last Post by Pride

No need to convert.

    Public Class Invalidate_Circle_On_Circle
        Dim ShowCircle As Boolean

        Private Sub MyPanel_Paint(sender As Object, e As PaintEventArgs) Handles MyPanel.Paint
            If ShowCircle Then
                e.Graphics.DrawEllipse(Pens.Black, New Rectangle(10, 10, 20, 20))
            End If
        End Sub

        Private Sub MyButton_Click(sender As Object, e As EventArgs) Handles MyButton.Click
            ShowCircle = True
        End Sub
    End Class

Just try to insert this into your code.

Why is there a boolean there?
I put a boolean there because if I don't then the circle might appear on the panel when it is first drawn(on application startup).

If you have anymore questions just start a new post.

Edited by Pride

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.