Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 Runtime Picturebox Help

$
0
0
So I'm trying to create a picture box at runtime, but my code just isn't working, no error or anything.

Code:

Dim componentVisual(10, 10) As PictureBox 'Global Variable
Sub displayNewComponent()
 Dim location As String = "F:\WindowsApplication1\WindowsApplication1\Resources\" + CStr(floor(mouse.x, mouse.y).type) + ".bmp"
 componentVisual(mouse.x, mouse.y) = New PictureBox
 componentVisual(mouse.x, mouse.y).Image = Image.FromFile(location)
 componentVisual(mouse.x, mouse.y).Visible = True
 componentVisual(mouse.x, mouse.y).Top = 12 + (mouse.x * 38)
 componentVisual(mouse.x, mouse.y).Left = 10 + (mouse.y * 38)
 componentVisual(mouse.x, mouse.y).Height = 31
 componentVisual(mouse.x, mouse.y).Width = 31
 Controls.Add(componentVisual(mouse.x, mouse.y))
End Sub

mouse.x,y store the last recorded mouse position
floor(mouse.x, mouse.y).type references the different images

If someone could help me out, it would be greatly appreciated.

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>