Adding custom property to Form

  • Thread starter Thread starter Michiel
  • Start date Start date
M

Michiel

Hello,

Can anyone tell me how I can add a custom property to a Form, so that it is
visible in the designer ?
I tried
[
Category("MyCategory"),
Description("Description"),
Browsable(true)
]
public int MyProperty
{
get { return m_MyProperty; }
set { m_MyProperty = value; Invalidate(); }
}

But this only seems to work for controls.

Thanks for your help,

Michiel.
 
Michiel said:
Hello,

Can anyone tell me how I can add a custom property to a Form, so that it is
visible in the designer ?
I tried
[
Category("MyCategory"),
Description("Description"),
Browsable(true)
]
public int MyProperty
{
get { return m_MyProperty; }
set { m_MyProperty = value; Invalidate(); }
}

But this only seems to work for controls.

Thanks for your help,

Michiel.

Hi Michiel,
Are you sure that you are using a base type like the INT in your example?
If you want to edit or show a custom type you need to assign a valid viewer
for that type, for example:

[Category("Custom Appearance"),
Description("MyBackColor."),

Editor(typeof(YuorColorEditorType), typeof(UITypeEditor))]
 
Mephiston said:
Michiel said:
Hello,

Can anyone tell me how I can add a custom property to a Form, so that it is
visible in the designer ?
I tried
[
Category("MyCategory"),
Description("Description"),
Browsable(true)
]
public int MyProperty
{
get { return m_MyProperty; }
set { m_MyProperty = value; Invalidate(); }
}

But this only seems to work for controls.

Thanks for your help,

Michiel.

Hi Michiel,
Are you sure that you are using a base type like the INT in your example?
If you want to edit or show a custom type you need to assign a valid
viewer
for that type, for example:

[Category("Custom Appearance"),
Description("MyBackColor."),

Editor(typeof(YuorColorEditorType), typeof(UITypeEditor))]

Yes, it's just an int.
I tried adding
Editor(typeof(int), typeof(UITypeEditor))

But that didn't help :(
 
Back
Top