Need Help with Component Directives

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tom P.

    Need Help with Component Directives

    I'm making a dropdown button (cause I can't get the one on the
    toolstrip to work correctly for me).

    I'm setting the AutoSize = true; and I'd like it to be ReadOnly. I can
    do all that, using "new" to hide the old property and access the old
    property using base.AutoSize from inside the subclass... etc.

    But what I can't get is the IDE to stop wanting to set the AutoSize
    property. This of course leads to a compiler error because the
    property is readonly. So I comment those lines out of the designer but
    if I touch the control (move it's location, set or delete the text,
    anything really) the designer tries to set those values again and I
    have to go and comment them out... again.

    I know there is a Directive (those statements in brackets that makes
    the IDE stop trying to set a property but I can't find it. There's
    even one to remove it from the Property list, but I can't find that
    either.

    Any help would be great, especially if you could tell me where to find
    all those cute little directives... that'd be awesome.

    Tom P.
  • Peter Duniho

    #2
    Re: Need Help with Component Directives

    On Fri, 15 Aug 2008 12:51:49 -0700, Tom P. <padilla.henry@ gmail.comwrote:
    I'm making a dropdown button (cause I can't get the one on the
    toolstrip to work correctly for me).
    >
    I'm setting the AutoSize = true; and I'd like it to be ReadOnly. I can
    do all that, using "new" to hide the old property and access the old
    property using base.AutoSize from inside the subclass... etc.
    First, you should not be hiding the old property. Use the "override"
    keyword and override it.
    [...]
    I know there is a Directive (those statements in brackets that makes
    the IDE stop trying to set a property but I can't find it. There's
    even one to remove it from the Property list, but I can't find that
    either.
    They are called "attributes ". You can use either [Browsable(false )] to
    hide the property altogether, or [ReadOnly(true)] to show it, but not
    allow it to be changed in the Designer.
    Any help would be great, especially if you could tell me where to find
    all those cute little directives... that'd be awesome.
    I'm not sure of the best place to find them. But one place to look is in
    the list of sub-classes for the Attribute class (near the end of the page):


    They are sorted by fully-qualified name, so all the System.Componen tModel
    namespace attributes are together.

    Pete

    Comment

    • Tom P.

      #3
      Re: Need Help with Component Directives

      On Aug 15, 3:11 pm, "Peter Duniho" <NpOeStPe...@nn owslpianmk.com>
      wrote:
      On Fri, 15 Aug 2008 12:51:49 -0700, Tom P. <padilla.he...@ gmail.comwrote:
      I'm making a dropdown button (cause I can't get the one on the
      toolstrip to work correctly for me).
      >
      I'm setting the AutoSize = true; and I'd like it to be ReadOnly. I can
      do all that, using "new" to hide the old property and access the old
      property using base.AutoSize from inside the subclass... etc.
      >
      First, you should not be hiding the old property.  Use the "override"  
      keyword and override it.
      Well, some of them (like Button.Image) are not overridable so I have
      to do it the other way. But, the ones I can override I am.

      >
      [...]
      I know there is a Directive (those statements in brackets that makes
      the IDE stop trying to set a property but I can't find it. There's
      even one to remove it from the Property list, but I can't find that
      either.
      >
      They are called "attributes ".  You can use either [Browsable(false )] to 
      hide the property altogether, or [ReadOnly(true)] to show it, but not  
      allow it to be changed in the Designer.
      >
      Ahh! Thank you (and thanks for letting me know what they are called).
      This is my first foray into component crfeation and I'm not up on all
      the terms.
      Any help would be great, especially if you could tell me where to find
      all those cute little directives... that'd be awesome.
      >
      I'm not sure of the best place to find them.  But one place to look is in  
      the list of sub-classes for the Attribute class (near the end of the page):http://msdn.microsoft.com/en-us/libr...attribute.aspx
      >
      They are sorted by fully-qualified name, so all the System.Componen tModel 
      namespace attributes are together.
      >
      Pete
      Thank you very much for that. That will be an enormous help.

      Tom P.

      Comment

      Working...