LoginDesigner.PreFilterProperties(IDictionary) 方法
定义
供设计器使用,以从“属性”网格的显示中移除属性或向其添加其他属性或者隐藏关联控件的属性。Used by the designer to remove properties from or add additional properties to the display in the Properties grid or to shadow properties of the associated control.
protected:
override void PreFilterProperties(System::Collections::IDictionary ^ properties);
protected override void PreFilterProperties (System.Collections.IDictionary properties);
override this.PreFilterProperties : System.Collections.IDictionary -> unit
Protected Overrides Sub PreFilterProperties (properties As IDictionary)
参数
- properties
- IDictionary
实现添加的和隐藏的属性的 IDictionary 的集合。A collection implementing the IDictionary of the added and shadowed properties.
示例
下面的代码示例创建一个派生自的类 LoginDesigner ,并重写 PreFilterProperties 方法,以便在设计时更改控件的 属性 网格 Login 。The following code sample creates a class derived from LoginDesigner, and overrides the PreFilterProperties method to change the Properties grid of a Login control at design time. 该示例使 NamingContainer 属性在 属性 网格中可见。The example makes the NamingContainer property visible in the Properties grid.
// Shadow the control properties with design-time properties.
protected override void PreFilterProperties(IDictionary properties)
{
// Call the base method first.
base.PreFilterProperties(properties);
// Make the NamingContainer visible in the Properties grid.
PropertyDescriptor selectProp =
(PropertyDescriptor)properties["NamingContainer"];
properties["NamingContainer"] =
TypeDescriptor.CreateProperty(selectProp.ComponentType,
selectProp, BrowsableAttribute.Yes);
} // PreFilterProperties
' Shadow the control properties with design-time properties.
Protected Overrides Sub PreFilterProperties( _
ByVal properties As IDictionary)
' Call the base method first.
MyBase.PreFilterProperties(properties)
' Make the NamingContainer visible in the Properties grid.
Dim selectProp As PropertyDescriptor = _
CType(properties("NamingContainer"), PropertyDescriptor)
properties("NamingContainer") = _
TypeDescriptor.CreateProperty(selectProp.ComponentType, _
selectProp, BrowsableAttribute.Yes)
End Sub
注解
控件设计器使用从方法派生的方法, ComponentDesigner.PreFilterProperties 用设计器实现的相应设计时属性隐藏各种控件属性,以及在 " 属性 " 网格中添加或删除属性。Control designers use methods that are derived from the ComponentDesigner.PreFilterProperties method to shadow various control properties with corresponding design-time properties that the designer implements, and to add properties to or remove properties from the Properties grid.
如果 LayoutTemplate 已为控件定义了属性 Login ,则 PreFilterProperties 会设置属性为的属性,这些属性不会在 BrowsableAttribute false " 属性 " 网格中显示。If a LayoutTemplate property has been defined for the Login control, the PreFilterProperties sets the BrowsableAttribute attribute of properties that do not apply when templated to false so those properties do not appear in the Properties grid.
继承者说明
重写 PreFilterProperties(IDictionary) 方法,以便在设计时属性集合中将属性添加到属性或更改属性的属性。Override the PreFilterProperties(IDictionary) method to add properties to or change attributes of properties in the design-time property collection. 请确保在执行其他处理之前调用基方法。Be sure to call the base method before performing other processing.