NonVisualControlAttribute 类

定义

定义指示在设计时将控件视为可视控件还是非可视控件的特性。Defines the attribute that indicates whether a control is treated as a visual or non-visual control during design time. 此类不能被继承。This class cannot be inherited.

public ref class NonVisualControlAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class)]
public sealed class NonVisualControlAttribute : Attribute
type NonVisualControlAttribute = class
    inherit Attribute
Public NotInheritable Class NonVisualControlAttribute
Inherits Attribute
继承
NonVisualControlAttribute
属性

示例

下面的代码示例演示如何将NonVisualControlAttribute特性应用于类。The following code example demonstrates how you can apply the NonVisualControlAttribute attribute to a class. 在此示例中, 将NonVisualControlAttribute默认属性应用于数据源控件。In this example, the default NonVisualControlAttribute attribute is applied to a data source control. 这等效于NonVisual字段。This is equivalent to the NonVisual field.

[NonVisualControlAttribute()]
public class CustomNonVisualControl : Control
{
    // Add an implementation of custom non-visual control.
}
<NonVisualControlAttribute()> _
Public Class CustomNonVisualControl
    Inherits Control

    ' Add an implementation of custom non-visual control.

End Class

注解

特性应用于不呈现到客户端的控件, 如数据源控件WebPartManager和控件。 NonVisualControlAttributeThe NonVisualControlAttribute attribute is applied to controls that are not rendered to the client, such as data source controls and the WebPartManager control. 在设计时, 页开发人员可能决定隐藏所有非可视控件。During design time, a page developer might decide to hide all non-visual controls. 设计器将标记为不可见所有NonVisualControlAttribute属性设置为true的控件。The designer would mark as invisible all of the controls with the NonVisualControlAttribute attribute set to true.

使用NonVisualControlAttribute特性的控件的示例包括DataSourceControlHierarchicalDataSourceControl HiddenField、和WebPartManagerExamples of controls that employ the NonVisualControlAttribute attribute are DataSourceControl, HierarchicalDataSourceControl, HiddenField, and WebPartManager.

构造函数

NonVisualControlAttribute()

初始化 NonVisualControlAttribute 类的新实例。Initializes a new instance of the NonVisualControlAttribute class.

NonVisualControlAttribute(Boolean)

使用指定的布尔值初始化 NonVisualControlAttribute 类的一个新实例以确定该特性表示的是可视控件还是非可视控件。Initializes a new instance of the NonVisualControlAttribute class, using the specified Boolean value to determine whether the attribute represents a visual or non-visual control.

字段

Default

返回一个 NonVisualControlAttribute 实例,该实例表示应用程序定义的该特性的默认值。Returns a NonVisualControlAttribute instance that represents the application-defined default value of the attribute. 此字段为只读。This field is read-only.

NonVisual

返回一个 NonVisualControlAttribute 实例,该实例应用于要在设计时视为非可视控件的 Web 控件。Returns a NonVisualControlAttribute instance that is applied to a Web control to be treated as a non-visual control during design time. 此字段为只读。This field is read-only.

Visual

获取一个 NonVisualControlAttribute 实例,该实例应用于要在设计时视为可视控件的 Web 控件。Gets a NonVisualControlAttribute instance that is applied to a Web control to be treated as a visual control during design time.

属性

IsNonVisual

获取一个值,该值指示控件是否为非可视控件。Gets a value indicating whether the control is non-visual.

TypeId

在派生类中实现时,获取此 Attribute 的唯一标识符。When implemented in a derived class, gets a unique identifier for this Attribute.

(继承自 Attribute)

方法

Equals(Object)

返回一个值,该值指示此实例是否与指定的对象相等。Returns a value that indicates whether this instance is equal to a specified object.

GetHashCode()

返回此实例的哈希代码。Returns the hash code for this instance.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
IsDefaultAttribute()

返回一个值,该值指示当前实例是否等效于 NonVisualControlAttribute 类的默认实例。Returns a value indicating whether the current instance is equivalent to a default instance of the NonVisualControlAttribute class.

Match(Object)

当在派生类中重写时,返回一个指示此实例是否等于指定对象的值。When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(继承自 Attribute)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

显式接口实现

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

将一组名称映射为对应的一组调度标识符。Maps a set of names to a corresponding set of dispatch identifiers.

(继承自 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

检索对象的类型信息,然后可以使用该信息获取接口的类型信息。Retrieves the type information for an object, which can be used to get the type information for an interface.

(继承自 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

检索对象提供的类型信息接口的数量(0 或 1)。Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(继承自 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供对某一对象公开的属性和方法的访问。Provides access to properties and methods exposed by an object.

(继承自 Attribute)

适用于

另请参阅