Click to See Complete Forum and Search --> : properties for user controls


abyclassic
June 12th, 2007, 06:13 AM
Dear All,

I am making a Windows Control Library(user control) using VS.NET & C#.NET. Now, i am

facing 3 problems:
1.In this control, i wants to remove some of the properties which are available by

default to the controls. These properties must be removed from the 'Properties window'

of the usercontrol. Also the user must not be able to set these properties using code.
I am able to remove the properties from the 'Properties window' by inheriting a class

from the System.Windows.Forms.Design.ScrollableControlDesigner & removing the properties

by overriding the PreFilterProperties function as show below:
protected override void PreFilterProperties(System.Collections.IDictionary

properties)
{
properties.Remove("BackColor");
}
But, doing so, this property is available to be set from the code. How can i remove this

property fully?

2.I wants to create a property for the control which has sub properties, like the

'Location' property of a button, which has sub properties as 'X, Y & Locked'.
My new property for the control must have some subproperties like this. How can i

achieve this?

3.I wants to add a property to the user control which allows the user to select a color.

When the user selects this property, it must display the same options which are

displayed for selecting the color for the satndard properties like 'BackColor'. Then the

user must be able to select the required color from these options & the value must be

stored in that specific property.

Kindly help me to acheieve the above scenarios

Best Regards,
Abhilash Chandran