By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,190 Members | 1,503 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,190 IT Pros & Developers. It's quick & easy.

Usercontrol

P: n/a
Wanna make a usercontrol that when seen from properties window has a "plus"
sign at left that indicate some members of a property. Like the property
Size of a form. Or like a collection like Items in the properties window

Thanks !

My english may not be good ;-)
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
When you add a public property that takes an object type that is not a basic
type, the properties window will automatically include the tree for that
property. For example, if you have some TextBoxes in your UserControl:
TextBox1, TextBox2, TextBox3, you could have UserControl properties to define
their locations: TextBox1Location, etc. Because a Location property is
defined by a Point object, the Property code in the UserControl would look
like this:

Public Property TextBox1Location() As Point
Get
Return Me.TextBox1.Location
End Get
Set(ByVal Value As Point)
Me.TextBox1.Location = Value
End Set
End Property

As you set the value in the Properties window, the Textbox will move.

You could also set properties that represent the contained controls
themselves:
Public Property Text1 as TextBox
Get
Return Me.TextBox1
End Get...

Then, when you go to the UserControl Properties window, you get all of the
properties available for that TextBox in the Text1 property tree.

www.charlesfarriersoftware.com

"Sylvain Barde" wrote:
Wanna make a usercontrol that when seen from properties window has a "plus"
sign at left that indicate some members of a property. Like the property
Size of a form. Or like a collection like Items in the properties window

Thanks !

My english may not be good ;-)

Nov 21 '05 #2

P: n/a


I know that, but if I have a property create by myself with few members
(like Point) but an other name

Thanks and have a nice day !

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #3

P: n/a
If you create public class with public properties, and then set a property in
your UserControl to the type represented by that public class, that
UserControl property will be displayed as a tree view.

Public collection types, whether existing, or inherited, will display with
an elipsis...
"Sylvain Barde" wrote:


I know that, but if I have a property create by myself with few members
(like Point) but an other name

Thanks and have a nice day !

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 21 '05 #4

P: n/a


I've tried this but with no succes. I will try again. Must I do some
imports like System.ComponentModel.

Thanks again !

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #5

P: n/a
I tried to code what you are describing and was very surprised that it did
not work. I am on deadline right now, but my initial research says that the
TypeConverter class and attribute are what can make this happen. I will
pursue this when I get time, and post back to this thread later. If you get
it figured out, please post what you find.

"Sylvain Barde" wrote:


I've tried this but with no succes. I will try again. Must I do some
imports like System.ComponentModel.

Thanks again !

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.