469,927 Members | 1,444 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

Dynamic Properties in user control

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
Nov 15 '05 #1
3 13502

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" <gu*@hcs-ltd.co.uk>
| Sender: "Guy Harwood" <gu*@hcs-ltd.co.uk>
| Subject: Dynamic Properties in user control
| Date: Thu, 14 Aug 2003 08:28:01 -0700
| Lines: 22
| Message-ID: <11****************************@phx.gbl>
| 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
|

Nov 15 '05 #2
i have done this already by adding the
[DesignerSerializationVisibility(DesignerSerializat ionVisibility.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????

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #3

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 <gu*@hcs-ltd.co.uk>
| References: <np**************@cpmsftngxa06.phx.gbl>
| 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: <#F**************@tk2msftngp13.phx.gbl>
| 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!tk2msftn gp13.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(DesignerSerializat ionVisibility.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????
|
|
|
| *** Sent via Developersdex http://www.developersdex.com ***
| Don't just participate in USENET...get rewarded for it!
|

Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Steve Gadlin | last post: by
3 posts views Thread by MikeY | last post: by
2 posts views Thread by Rubble | last post: by
reply views Thread by jaawaad | last post: by
9 posts views Thread by Tarscher | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.