.NET Properties

Discussion in 'AutoCAD' started by HJohn, Aug 13, 2004.

  1. HJohn

    HJohn Guest

    I created a custom control inheriting the Control Class. I added the necessary properties for it and now I would like to hide some of the base Class properties, BackColor for instance. I tried using the attribute Browsable(False) on an override of the BackColor property, but didn't work. I think I read somewhere that the base properties can be hidden from the property box, but I can find it now. Can someone help me on this? Any ideas or solutions will be greatly appreciated.
     
    HJohn, Aug 13, 2004
    #1
  2. It can be done with a custom type converter class. Create a class that
    inherits from TypeConverter. Override the GetPropertiesSupported() method
    and have it return true. Then override the GetProperties() method. Here
    you can get a collection of property descriptors that your control exposes
    by calling TypeDescriptor.GetProperties(value, attributes, true). You can
    filter this collection to remove property descriptors that you want to hide
    and return the filtered collection.

    Set your control class to use your custom type converter with the
    TypeConverter attribute.
    --
    Bobby C. Jones

    necessary properties for it and now I would like to hide some of the base
    Class properties, BackColor for instance. I tried using the attribute
    Browsable(False) on an override of the BackColor property, but didn't work.
    I think I read somewhere that the base properties can be hidden from the
    property box, but I can find it now. Can someone help me on this? Any
    ideas or solutions will be greatly appreciated.
     
    Bobby C. Jones, Aug 13, 2004
    #2
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 (here). After that, you can post your question and our members will help you out.