Add a shape to a picture box at run time
I am trying to add a circle to a picture box at run time.
I tried the following , but I see no shape
Dim Shape5 As Shape
Set Shape5 = Controls.Add("vb.shape", "Myshape", Me)
Shape5.BackStyle = 1
Shape5.BackColor = vbRed
The picture box is named "Pbox2"
Thanks for your help
Re: Add a shape to a picture box at run time
Your shape is not visible
Code:
Shape5.Visible = True
Re: Add a shape to a picture box at run time
Double post for some reason?
Re: Add a shape to a picture box at run time
Quote:
I am trying to add a circle to a picture box at run time.
I tried the following , but I see no shape
Try the following ! .
Code:
Dim Shape5 As Shape
Set Shape5 = Controls.Add("vb.shape", "Myshape", Me)
shap5.visible=true
Shape5.BackStyle = 1
Shape5.BackColor = vbRed
Re: Add a shape to a picture box at run time
Also if you want it inside picturebox do this
Code:
Set Shape5.Container = PBox2
Re: Add a shape to a picture box at run time
Yes Max187Boucher suggestion .i will also recommend .
Code:
Dim Shape5 As Shape
Set Shape5 = Controls.Add("vb.shape", "Myshape", Me)
Set Shape5.Container = PBox2
shap5.visible=true
Shape5.BackStyle = 1
Shape5.BackColor = vbRed