Dynamic Properties in user control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Guy Harwood

    #1

    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
  • Jeffrey Tan[MSFT]

    #2
    RE: Dynamic Properties in user control


    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" <guy@hcs-ltd.co.uk>
    | Sender: "Guy Harwood" <guy@hcs-ltd.co.uk>
    | Subject: Dynamic Properties in user control
    | Date: Thu, 14 Aug 2003 08:28:01 -0700
    | Lines: 22
    | Message-ID: <116801c36278$a 5c82220$a401280 a@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: AcNieKXIo2HVrlt RTTu5C0ni54LFSw ==
    | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
    | Path: cpmsftngxa06.ph x.gbl
    | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1764 56
    | NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
    | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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
    |

    Comment

    • Guy Harwood

      #3
      RE: Dynamic Properties in user control

      i have done this already by adding the
      [DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.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!

      Comment

      • Jeffrey Tan[MSFT]

        #4
        RE: Dynamic Properties in user control


        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 <guy@hcs-ltd.co.uk>
        | References: <npdlPLvYDHA.22 96@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: <#FG8HawYDHA.29 60@tk2msftngp13 .phx.gbl>
        | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
        | Date: Fri, 15 Aug 2003 01:23:38 -0700
        | NNTP-Posting-Host: actionjackson13 3.dsl.frii.net 216.17.147.133
        | Lines: 1
        | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!tk2 msftngp13.phx.g bl
        | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1766 18
        | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
        |
        | i have done this already by adding the
        | [DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.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!
        |

        Comment

        Working...