adding code when creating collection

  • Thread starter Thread starter Bekende Vlaming
  • Start date Start date
B

Bekende Vlaming

Hi,
I looked everywhere (probably not) but did not find any
answers. That's why I turned to you guys.

Is there a way to insert code into the InitializeComponent
method, which reflect the items added by a component
editor. For instance, when you drop a TreeView on a form
you can visually add some nodes, while code is
automatically inserted in the previously mentioned
method. Is this behaviour hardcoded into the IDE and
therefor only available for the standard components, or is
it possible to add your own extensions to the IDE.
Any help, or a hint to get started would be very
appreciated.

Bekende Vlaming
(e-mail address removed) (the underscores have to be
removed to get the real address).
 
Hi,

If you make a custom control derived from UserControl (or from component),
then the public properties can be handled to same way.

How the public properties are presented in the property window and how they
are persisted depends on different attributes you can place before the
properties.

E.g.

[
Description("Get length"),
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)
]
public int Length
{
get
{
return _length;
}
}

The second attribute DesignerSeria... with the parameter Visible, makes the
IDE persist the property values into _client_ code (InitializeComponent),
but it's the default, so you can ommit it.
There are other attributes which let the IDE deal with not clr compliant
types.


HTH
Greetings
 
Hi,

thank you very much, I think this got me started. I've
still got a lot of digging ahead, but I will get there
sooner or later.
Regards,
BV
-----Original Message-----
Hi,

If you make a custom control derived from UserControl (or from component),
then the public properties can be handled to same way.

How the public properties are presented in the property window and how they
are persisted depends on different attributes you can place before the
properties.

E.g.

[
Description("Get length"),
DesignerSerializationVisibility (DesignerSerializationVisibility.Visible)
]
public int Length
{
get
{
return _length;
}
}

The second attribute DesignerSeria... with the parameter Visible, makes the
IDE persist the property values into _client_ code (InitializeComponent),
but it's the default, so you can ommit it.
There are other attributes which let the IDE deal with not clr compliant
types.


HTH
Greetings





Hi,
I looked everywhere (probably not) but did not find any
answers. That's why I turned to you guys.

Is there a way to insert code into the InitializeComponent
method, which reflect the items added by a component
editor. For instance, when you drop a TreeView on a form
you can visually add some nodes, while code is
automatically inserted in the previously mentioned
method. Is this behaviour hardcoded into the IDE and
therefor only available for the standard components, or is
it possible to add your own extensions to the IDE.
Any help, or a hint to get started would be very
appreciated.

Bekende Vlaming
(e-mail address removed) (the underscores have to be
removed to get the real address).


.
 
Back
Top