Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / May 2006

Tip: Looking for answers? Try searching our database.

How to hide inherited properties for a custom control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
daniel - 22 May 2006 22:02 GMT
Hi all,

I created a new control derived from UserControl class. For this new control
I added some new properties. How can I show only these new properties for
this control at design time in PropertyGrid control?

Thanks,
Dan
David Husselmann - 23 May 2006 06:08 GMT
In your designer class, have a look at overriding the PreFilterProperties
method.  This allows you to remove properties from the property grid.

[code]
   protected override void
PreFilterProperties(System.Collections.IDictionary properties) {
     base.PreFilterProperties(properties);

     properties.Remove("AccessibleDescription");
     properties.Remove("AccessibleName");
     properties.Remove("AccessibleRole");
   }
[/code]

> Hi all,
>
[quoted text clipped - 4 lines]
> Thanks,
> Dan
Carlo (mcp) - 23 May 2006 10:12 GMT
Hi
this is good for classes that has a visual design-mode interface. They must
have a Designer attribute. But what's about a class that does NOT has
Designer attribute?
.c.

-------------------------------------------
Carlo, MCP (Windows Based Applications)
carlodevREMOVE@gmail.com

> In your designer class, have a look at overriding the PreFilterProperties
> method.  This allows you to remove properties from the property grid.
[quoted text clipped - 19 lines]
>> Thanks,
>> Dan
V - 23 May 2006 10:48 GMT
Hi Carlo, I am not sure if this will work, but you could override all
the base class properties in your derived class and attach the
attribute which makes them invisible in the Property Grid.

- Vaibhav
V - 23 May 2006 10:50 GMT
I looked it up and the attribute that you can add to the Overriding
properties in the derived class would be [Browsable(false)]

- Vaibhav
Dei - 23 May 2006 11:57 GMT
My control inherited some properties like Location, Size. How can I override
these properties in my derived class?
I removed "Location" properties for my control by overiding
PreFilterProperties function but in this case I'm not able to move my
control using. All the time the location will be (0, 0).

>I looked it up and the attribute that you can add to the Overriding
> properties in the derived class would be [Browsable(false)]
>
> - Vaibhav
DEI - 23 May 2006 14:34 GMT
Do you have any ideea how to hide "Location" propertie. (how to set
Browsable(false) for it) ?

Thanks,
Daniel

>I looked it up and the attribute that you can add to the Overriding
> properties in the derived class would be [Browsable(false)]
>
> - Vaibhav

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.