Freigeben über


PropertyGrid-Klasse

Stellt eine Benutzeroberfläche zum Durchsuchen der Eigenschaften eines Objekts bereit.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
<ComVisibleAttribute(True)> _
Public Class PropertyGrid
    Inherits ContainerControl
    Implements IComPropertyBrowser
'Usage
Dim instance As PropertyGrid
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
[ComVisibleAttribute(true)] 
public class PropertyGrid : ContainerControl, IComPropertyBrowser
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] 
[ComVisibleAttribute(true)] 
public ref class PropertyGrid : public ContainerControl, IComPropertyBrowser
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class PropertyGrid extends ContainerControl implements IComPropertyBrowser
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
ComVisibleAttribute(true) 
public class PropertyGrid extends ContainerControl implements IComPropertyBrowser

Hinweise

Erstellen Sie zum Verwenden des Eigenschaftenrasters eine neue Instanz der PropertyGrid-Klasse für ein übergeordnetes Steuerelement, und legen Sie SelectedObject auf das Objekt fest, für das die Eigenschaften angezeigt werden sollen.

Die im Datenblatt angezeigten Informationen sind ein Snapshot der Eigenschaften während der Zuweisung des Objekts. Wenn ein Eigenschaftenwert des von SelectedObject angegebenen Objekts zur Laufzeit im Code geändert wird, wird der neue Wert erst angezeigt, wenn das Datenblatt durch eine Aktion aktualisiert wird.

Die Registerkarten für Eigenschaften werden im Eigenschaftenraster auf der Symbolleiste oben im PropertyGrid als Schaltflächen angezeigt und können je nach Definition in PropertyTabScope verschiedene Gültigkeitsbereiche haben.

Das PropertyGrid-Steuerelement wird anfänglich in der Toolbox der Entwicklungsumgebung nicht angezeigt. Sie können der Toolbox ein Eigenschaftenraster hinzufügen, wodurch das Verschieben von PropertyGrid-Objekten in das Formular mithilfe von Drag & Drop ermöglicht wird. Sie können auch eine Instanz von PropertyGrid definieren, indem Sie dem Quellcode den entsprechenden Code hinzufügen.

Beispiel

Im folgenden Codebeispiel werden das Erstellen eines Eigenschaftenrasters und das Festlegen seiner Position in einem Formular veranschaulicht. Bei diesem Codebeispiel muss ein Formular vorhanden sein, das ein TextBox enthält.

public Form1() {

   // The initial constructor code goes here.
 
   PropertyGrid propertyGrid1 = new PropertyGrid();
   propertyGrid1.CommandsVisibleIfAvailable = true;
   propertyGrid1.Location = new Point(10, 20);
   propertyGrid1.Size = new System.Drawing.Size(400, 300);
   propertyGrid1.TabIndex = 1;
   propertyGrid1.Text = "Property Grid";

   this.Controls.Add(propertyGrid1);

   propertyGrid1.SelectedObject = textBox1;
}
public:
   [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")]
   Form1()
   {
      // The initial constructor code goes here.

      PropertyGrid^ propertyGrid1 = gcnew PropertyGrid;
      propertyGrid1->CommandsVisibleIfAvailable = true;
      propertyGrid1->Location = Point( 10, 20 );
      propertyGrid1->Size = System::Drawing::Size( 400, 300 );
      propertyGrid1->TabIndex = 1;
      propertyGrid1->Text = "Property Grid";

      this->Controls->Add( propertyGrid1 );

      propertyGrid1->SelectedObject = textBox1;
   }

Vererbungshierarchie

System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
       System.Windows.Forms.Control
         System.Windows.Forms.ScrollableControl
           System.Windows.Forms.ContainerControl
            System.Windows.Forms.PropertyGrid

Threadsicherheit

Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

PropertyGrid-Member
System.Windows.Forms-Namespace
PropertyTabScope