.net - Removing only one drawn image from screen -
i have drawn 2 images on form code:
public class drawimage dim image = image.fromfile("e:\1.png") dim image2 = image.fromfile("e:\2.png") private sub testbutton_click(byval sender system.object, byval e system.eventargs) handles testbutton.click me.creategraphics.drawimage(image, 0, 0, 100, 100) me.creategraphics.drawimage(image2, 200, 200, 100,100) end sub and want remove 1 of images programmatically, tried code:
me.creategraphics.clear(me.backcolor) but cleared images. can clear 1 image? 1 named "image".
drawing , painting things want persist, needs done in paint event. every time windows tells form repaint, images drawn. is, if form floats across it, lost. also, keeps having create graphics objects.
to rid if one, need flag. work:
private drawboth boolean = true private sub button1_click(sender object, e eventargs) handles button1.click drawboth = not drawboth me.invalidate end sub private sub form1_paint(sender object, e painteventargs) handles me.paint e.graphics.drawimage(img, 0, 0, 100, 100) if drawboth e.graphics.drawimage(img2, 200, 200, 100, 100) end if end sub image bad name bitmap or image because there image type in .net using. things (including you) can confused between your image , system.drawing.image
.net vb.net image
No comments:
Post a Comment