button cant draw rectangle vb.net -


i'm trying draw rectangle clicking button, simple thought can't right.

private sub button36_click(byval sender system.object, byval e system.eventargs) handles button36.click     ' create pen.      dim blackpen new pen(color.black, 1)      ' create rectangle.      dim rect new rectangle(10, 710, 35, 100)      ' draw rectangle screen.     me.creategraphics.drawrectangle(blackpen, rect) end sub 

i'm using vb.net

you need of drawing inside paint event.
otherwise, windows erase next time form repaints.

add handler paint event , draw inside using e.graphics.
need keep track of needs painted @ times.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -