Creating a Picture Box
-
I'm trying to write some code that creates a picture box at a certain location when a user clicks a button. I am using this statement to initialize the picturebox:
Dim blip As Bitmap
blip = New Bitmap(filename of bitmap goes here)
Dim blipcase As New PictureBox
blipcase.Image = blipand this statement to place the picturebox:
Dim Theta As Double = (Point.Y * PI) / 180
Dim location As New Point
location.X = (225 + ((Cos(Theta) * (30 * Point.X)) - 5))
location.Y = (225 + ((Sin(Theta) * (30 * Point.X)) - 5))
blipcase.Location = location(Point is a system.drawing.point that contains the polar coordinates of the point) Now, during a break in the program, I can see that location contains the right coordinates. However, I cannot get the picturebox to appear. So I do not think it is the location part that is wrong, but the initialization that is wrong. Can anyone else see something that I might be missing?
-
I'm trying to write some code that creates a picture box at a certain location when a user clicks a button. I am using this statement to initialize the picturebox:
Dim blip As Bitmap
blip = New Bitmap(filename of bitmap goes here)
Dim blipcase As New PictureBox
blipcase.Image = blipand this statement to place the picturebox:
Dim Theta As Double = (Point.Y * PI) / 180
Dim location As New Point
location.X = (225 + ((Cos(Theta) * (30 * Point.X)) - 5))
location.Y = (225 + ((Sin(Theta) * (30 * Point.X)) - 5))
blipcase.Location = location(Point is a system.drawing.point that contains the polar coordinates of the point) Now, during a break in the program, I can see that location contains the right coordinates. However, I cannot get the picturebox to appear. So I do not think it is the location part that is wrong, but the initialization that is wrong. Can anyone else see something that I might be missing?
You didn't add the new PictureBox to your Form's Controls collection:
Dim blipcase As New PictureBox()
Me.Controls.Add(blipcase)Dave Kreskowiak Microsoft MVP - Visual Basic
-
You didn't add the new PictureBox to your Form's Controls collection:
Dim blipcase As New PictureBox()
Me.Controls.Add(blipcase)Dave Kreskowiak Microsoft MVP - Visual Basic