-
Mar 16th, 2013, 04:03 PM
#1
Thread Starter
Addicted Member
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?
-
Mar 16th, 2013, 04:21 PM
#2
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
Last edited by Edgemeal; Mar 16th, 2013 at 04:24 PM.
-
Mar 16th, 2013, 04:41 PM
#3
Thread Starter
Addicted Member
Re: Modify User Control from Application Design?
Thanks man, that did the job, I got the idea now.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|