all groups > dotnet windows forms designtime > august 2004 >
You're in the

dotnet windows forms designtime

group:

Hide a default property


Hide a default property Andrea Moro
8/3/2004 2:59:15 PM
dotnet windows forms designtime:
Is there a way to hide some default property of control?
I'm writing my own usercontrol, and I would like to hide
some of them. For e.g. the locked property or many other.

--
Thanks in advance
Andrea

Re: Hide a default property Özden Irmak
8/4/2004 2:18:48 AM
Overriding the property with "Shadows" in VB.Net or "new" in C# should do
the trick...When you override, don't forget to mark the property's browsable
attribute as false...

Regards,

Özden

[quoted text, click to view]

Re: Hide a default property Andrea Moro
8/4/2004 9:10:49 AM
Özden,

thanks. It works fine, for all properties I tried
except for the locked. It doesn't accept shadowing
nor overriding.
Code looks ok, and no error is reported by the
framework, but at design time, also setting browsable
property to false, and changing the category,
locked continue to stay to design category and visbile.

Do you know anything about it?

Andrea

Re: Hide a default property Özden Irmak
8/4/2004 9:39:07 PM
Andrea,

You may also try to filter the property...

Apply a custom designer to your control and override the
PostFilterProperties method and remove the "Locked" property from the given
properties collection...

Regards,

Özden


[quoted text, click to view]

Re: Hide a default property Andrea Moro
8/4/2004 9:44:49 PM
Özden

could you make me an example? I'm finding some difficulties
to implement it.

Thanks
Andrea

Re: Hide a default property Özden Irmak
8/5/2004 1:22:36 PM
Hi Andrea,

Apply the designer class to your custom control class like :
[Designer(typeof(SampleDesigner))]

Here's the code of the Designer class :
public class SampleDesigner : ControlDesigner

{

protected override void PostFilterProperties(System.Collections.IDictionary
properties)

{

foreach(string prop in _unneededProperties) properties.Remove(prop);

base.PostFilterProperties(properties);

}

private static readonly string[] _unneededProperties = {

"Anchor",

"BackColor",

"CausesValidation",

"Dock",

"ImeMode",

"Location",

"Size",

"TabIndex",

"TabStop",

"AccessibleDescription",

"AccessibleName",

"AccessibleRole",

"AllowDrop",

"Enable",

"Visible",

"Enabled",

"Locked",

"AutoScroll",

"AutoScrollMargin",

"AutoScrollMinSize",

"DockPadding",

"ContextMenu",

"RightToLeft",

"BackgroundImage",

"Tag"

};

}

Hope it helps...:)

Regards,

Özden

[quoted text, click to view]

Re: Hide a default property Andrea Moro
8/5/2004 3:05:06 PM
Özden,

I'm using VB, but this isn't the main problem.
I'm inheriting from a usercontrol, so controldesigner
isn't available for me.

I've the same problems, trying to overlads the
OnSetComponentDefaults.

It's a member of system.design.componentmodel ...

I'm loosing in a glass of water ... or in a ocean ...
I don't know.

Andrea

AddThis Social Bookmark Button