add - Make a Button that creates and places new Buttons with the Mouse -
hello can me:
i m trying create simple application in vb, make button, creates , places new buttons using mouse alocating them.
also assigning new buttons function autoerased, let's popup window , remove text button.
public class form1 dim bmp new drawing.bitmap(640, 480) dim gfx graphics = graphics.fromimage(bmp) dim dynamicbutton new button private sub button1_click(sender object, e eventargs) handles button1.click gfx.fillrectangle(brushes.white, 0, 0, picturebox1.width, picturebox1.height) picturebox1.image = bmp end sub private sub picturebox1_click(byval sender system.object, byval e eventargs) handles picturebox1.click dynamicbutton.location = new point(mouseposition.x - me.location.x - picturebox1.location.x - 28, mouseposition.y - me.location.y - picturebox1.location.y - 50) dynamicbutton.height = 20 dynamicbutton.width = 100 dynamicbutton.backcolor = color.blue dynamicbutton.forecolor = color.aliceblue dynamicbutton.text = "link_1" dynamicbutton.name = "dynamicbutton" dynamicbutton.font = new font("arial", 10) dynamicbutton.bringtofront() picturebox1.image = bmp end sub private sub button2_click(sender object, e eventargs) handles button2.click controls.add(dynamicbutton) end sub private sub form1_load(sender object, e eventargs) handles mybase.load me.transparencykey = backcolor end sub end class
Comments
Post a Comment