Usercontrol

  • Thread starter Thread starter Sylvain Barde
  • Start date Start date
S

Sylvain Barde

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 ;-)
 
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
 
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 !
 
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...
 
I've tried this but with no succes. I will try again. Must I do some
imports like System.ComponentModel.

Thanks again !
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top