DesignerSerializationVisibilityAttribute 构造函数

定义

使用指定的 DesignerSerializationVisibility 值初始化 DesignerSerializationVisibilityAttribute 类的新实例。

public:
 DesignerSerializationVisibilityAttribute(System::ComponentModel::DesignerSerializationVisibility visibility);
public DesignerSerializationVisibilityAttribute (System.ComponentModel.DesignerSerializationVisibility visibility);
new System.ComponentModel.DesignerSerializationVisibilityAttribute : System.ComponentModel.DesignerSerializationVisibility -> System.ComponentModel.DesignerSerializationVisibilityAttribute
Public Sub New (visibility As DesignerSerializationVisibility)

参数

示例

下面的代码示例指定设计器如何保存组件上的属性。 此代码创建一个新的 DesignerSerializationVisibilityAttribute ,并将其值设置为 DesignerSerializationVisibilityAttribute.Content

public:
   [DesignerSerializationVisibility(DesignerSerializationVisibility::Content)]
   property int MyProperty 
   {
      int get()
      {
         // Insert code here.
         return (0);
      }
      void set( int value )
      {
         // Insert code here.
      }
   }
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
 public int MyProperty {
    get {
       // Insert code here.
       return(0);
    }
    set {
       // Insert code here.
    }
 }

<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
Public Property _
    MyProperty() As Integer
    
    Get
        ' Insert code here.
        Return 0
    End Get
    Set
        ' Insert code here.
    End Set 
End Property

适用于

另请参阅