Modify User Control from Application Design?
Hi guys, I just made a simple user control (my first one) so I have close to 0 ideas about how to manipulate them.
Anyway, my user control has 3 pictureboxes with a bunch of code. What I would like to do is edit the background images of these pictureboxes when I add my control from the toolbox, but I can only click and modify the properties of the whole usercontrol, and not the pictureboxes it contains.
How would I make the pictureboxes modifiable just like the usercontrol itself?
Re: Modify User Control from Application Design?
Try creating properties for them in the UC code, something like...
Code:
Private _pic1BackImg As Image
Public Property pic1backImg() As Image
Get
Return _pic1BackImg
End Get
Set(ByVal value As Image)
_pic1BackImg = value
PictureBox1.BackgroundImage = value
End Set
End Property
Private _pic2BackImg As Image
Public Property pic2backImg() As Image
Get
Return _pic2BackImg
End Get
Set(ByVal value As Image)
_pic2BackImg = value
PictureBox2.BackgroundImage = value
End Set
End Property
EDIT Not sure you even need to set a private variable, could just try...
Code:
Public Property pic1backImg() As Image
Get
Return PictureBox1.BackgroundImage
End Get
Set(ByVal value As Image)
PictureBox1.BackgroundImage = value
End Set
End Property
Public Property pic2backImg() As Image
Get
Return PictureBox2.BackgroundImage
End Get
Set(ByVal value As Image)
PictureBox2.BackgroundImage = value
End Set
End Property
Re: Modify User Control from Application Design?
Thanks man, that did the job, I got the idea now.