Dynamic Properties in user control

  • Thread starter Thread starter Guy Harwood
  • Start date Start date
G

Guy Harwood

Hi,

I have designed a textbox that inherits from the
System.Windows.Forms.Textbox control.

when the control is readonly the back color changes to a
light blue to indicate that it is frozen.

This all works well, but i would like the color to be
configurable via the app.config file.

i know how to do this but would like to add the jazz of
using the properties window (like what the SqlConnection
component does), in that you can open the dynamic
properties window and tell the control via ticking the box
to store the connection string in the application
configuration file and it lets you specify a key name for
it.

how do i implement this functionality into my control???

Thanks in advance
 
Hi Guy,
I think you can create your own control that inherts the textbox.(You also
can create a usercontrol that similar to the textbox)
Then, you can create a property to expose the textbox's back color property.
The VS.NET IDE will put the property you create in both property window
and Dynamic property window.
Then you can add back color property to app.config file through IDE.

Hope this helps.

Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "Guy Harwood" <[email protected]>
| Sender: "Guy Harwood" <[email protected]>
| Subject: Dynamic Properties in user control
| Date: Thu, 14 Aug 2003 08:28:01 -0700
| Lines: 22
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcNieKXIo2HVrltRTTu5C0ni54LFSw==
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:176456
| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Hi,
|
| I have designed a textbox that inherits from the
| System.Windows.Forms.Textbox control.
|
| when the control is readonly the back color changes to a
| light blue to indicate that it is frozen.
|
| This all works well, but i would like the color to be
| configurable via the app.config file.
|
| i know how to do this but would like to add the jazz of
| using the properties window (like what the SqlConnection
| component does), in that you can open the dynamic
| properties window and tell the control via ticking the box
| to store the connection string in the application
| configuration file and it lets you specify a key name for
| it.
|
| how do i implement this functionality into my control???
|
| Thanks in advance
|
 
i have done this already by adding the
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible
)]

attribute to my 'ReadOnlyColor' property. but it does not automatically
appear in the dynamic properties window and this is the functionality i
would like.

is there an attribute i need to add????
 
Hi Guy,

After my research, I found that the dynamic property window can only
display the property that is primitive type.
The back color property of textbox is System.Drawing.Color type, so it can
not appear in that window.

But I think you can inherit the textbox and create a property that expose
the textbox's back color as RGB color
so that it can be store as primitive type.
Hope this helps.

If you still have any unclear, please feel free to tell me.

Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: Guy Harwood <[email protected]>
| References: <[email protected]>
| X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
| Subject: RE: Dynamic Properties in user control
| Mime-Version: 1.0
| Content-Type: text/plain; charset="us-ascii"
| Content-Transfer-Encoding: 7bit
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Date: Fri, 15 Aug 2003 01:23:38 -0700
| NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
| Lines: 1
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:176618
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| i have done this already by adding the
| [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible
| )]
|
| attribute to my 'ReadOnlyColor' property. but it does not automatically
| appear in the dynamic properties window and this is the functionality i
| would like.
|
| is there an attribute i need to add????
|
|
|
|
| Don't just participate in USENET...get rewarded for it!
|
 
Back
Top