Design time property on a control

D

David Glover

Hi,

I have worked through the example at
http://www.intelliprog.com/articles/index.html to create a control,
however I have a question. How do I create a property which will be
accessible from the properties window of the designer?

I wish to add a Maximum Value, and Control Colour property, and the
details provided in the article are not very detailed as to how you go
about this.

Many thanks for any help,

Regards,

David Glover
 
M

Maarten Struys

Is it clear how design time support works for controls? When you just create
public properties on a control with design time support they will be added
automatically to the properties window of the designer. The article shows
how to set a default value for a property and how to add intellisense
information for VS.NET by using attributes. Other attributes exist to
explicitely hide control properties from the properties window etc. The
online help in VS.NET 2003 (look for "design-time functionality, about
design-time functionality") might be helpfull. Just realize that you need to
compile this conditionally for designer support for a .NET CF application.
Hopes this helps you a little further.
 
D

David So [MSFT]

Simply place the property code within the class

public int MaximumValue
{
get
{
return m_maxValue;
}
set
{
m_maxValue = value;

this.Invalidate();
}
}

public System.Drawing.Color Color
{
get
{
return m_Color;
}
set
{
m_Color = value;
this.Invalidate();
}
}

And it would automatically appears in the designer when you compile your
design time version.

David
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "Maarten Struys" <[email protected]>
| References: <[email protected]>
| Subject: Re: Design time property on a control
| Date: Tue, 30 Sep 2003 23:27:52 +0200
| Lines: 37
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: stejo.com 62.58.149.90
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:34808
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Is it clear how design time support works for controls? When you just
create
| public properties on a control with design time support they will be added
| automatically to the properties window of the designer. The article shows
| how to set a default value for a property and how to add intellisense
| information for VS.NET by using attributes. Other attributes exist to
| explicitely hide control properties from the properties window etc. The
| online help in VS.NET 2003 (look for "design-time functionality, about
| design-time functionality") might be helpfull. Just realize that you need
to
| compile this conditionally for designer support for a .NET CF application.
| Hopes this helps you a little further.
|
| --
| Regards,
|
| Maarten Struys
| PTS Software bv
|
| | > Hi,
| >
| > I have worked through the example at
| > http://www.intelliprog.com/articles/index.html to create a control,
| > however I have a question. How do I create a property which will be
| > accessible from the properties window of the designer?
| >
| > I wish to add a Maximum Value, and Control Colour property, and the
| > details provided in the article are not very detailed as to how you go
| > about this.
| >
| > Many thanks for any help,
| >
| > Regards,
| >
| > David Glover
|
|
|
 

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

Top