TreeView.FullRowSelect Eigenschaft

Definition

Ruft einen Wert ab, der angibt, ob die Auswahlmarkierung die gesamte Breite des Strukturansicht-Steuerelements umfasst, oder legt diesen fest.

public:
 property bool FullRowSelect { bool get(); void set(bool value); };
public bool FullRowSelect { get; set; }
member this.FullRowSelect : bool with get, set
Public Property FullRowSelect As Boolean

Eigenschaftswert

Boolean

true, wenn die Auswahlmarkierung die gesamte Breite des Strukturansicht-Steuerelements umfasst, andernfalls false. Der Standardwert ist false.

Beispiele

Im folgenden Codebeispiel wird ein angepasstes TreeViewBeispiel veranschaulicht. Durch Erben der TreeView Klasse verfügt diese benutzerdefinierte Version über alle Funktionen einer typischen TreeView. Das Ändern verschiedener Eigenschaftswerte im Konstruktor bietet eine eindeutige Darstellung. Da die ShowPlusMinus Eigenschaft auf falsefestgelegt ist, überschreibt das angepasste Steuerelement auch die OnAfterSelect Methode, damit Knoten erweitert und reduziert werden können, wenn sie geklickt werden.

Ein Steuerelement, das auf diese Weise angepasst wird, kann in einer gesamten Organisation verwendet werden, wodurch es einfach ist, eine konsistente Schnittstelle bereitzustellen, ohne dass die Steuerelementeigenschaften in jedem einzelnen Projekt angegeben werden müssen.

public ref class CustomizedTreeView: public TreeView
{
public:
   CustomizedTreeView()
   {

      // Customize the TreeView control by setting various properties.
      BackColor = System::Drawing::Color::CadetBlue;
      FullRowSelect = true;
      HotTracking = true;
      Indent = 34;
      ShowPlusMinus = false;

      // The ShowLines property must be false for the FullRowSelect
      // property to work.
      ShowLines = false;
   }

protected:
   virtual void OnAfterSelect( TreeViewEventArgs^ e ) override
   {
      // Confirm that the user initiated the selection.
      // This prevents the first node from expanding when it is
      // automatically selected during the initialization of
      // the TreeView control.
      if ( e->Action != TreeViewAction::Unknown )
      {
         if ( e->Node->IsExpanded )
         {
            e->Node->Collapse();
         }
         else
         {
            e->Node->Expand();
         }
      }

      
      // Remove the selection. This allows the same node to be
      // clicked twice in succession to toggle the expansion state.
      SelectedNode = nullptr;
   }
};
public class CustomizedTreeView : TreeView
{
    public CustomizedTreeView()
    {
        // Customize the TreeView control by setting various properties.
        BackColor = System.Drawing.Color.CadetBlue;
        FullRowSelect = true;
        HotTracking = true;
        Indent = 34;
        ShowPlusMinus = false;

        // The ShowLines property must be false for the FullRowSelect 
        // property to work.
        ShowLines = false;
    }

    protected override void OnAfterSelect(TreeViewEventArgs e)
    {
        // Confirm that the user initiated the selection.
        // This prevents the first node from expanding when it is
        // automatically selected during the initialization of 
        // the TreeView control.
        if (e.Action != TreeViewAction.Unknown)
        {
            if (e.Node.IsExpanded) 
            {
                e.Node.Collapse();
            }
            else 
            {
                e.Node.Expand();
            }
        }

        // Remove the selection. This allows the same node to be
        // clicked twice in succession to toggle the expansion state.
        SelectedNode = null;
    }
}
Public Class CustomizedTreeView
    Inherits TreeView

    Public Sub New()
        ' Customize the TreeView control by setting various properties.
        BackColor = System.Drawing.Color.CadetBlue
        FullRowSelect = True
        HotTracking = True
        Indent = 34
        ShowPlusMinus = False

        ' The ShowLines property must be false for the FullRowSelect 
        ' property to work.
        ShowLines = False
    End Sub


    Protected Overrides Sub OnAfterSelect(ByVal e As TreeViewEventArgs)
        ' Confirm that the user initiated the selection.
        ' This prevents the first node from expanding when it is
        ' automatically selected during the initialization of 
        ' the TreeView control.
        If e.Action <> TreeViewAction.Unknown Then
            If e.Node.IsExpanded Then
                e.Node.Collapse()
            Else
                e.Node.Expand()
            End If
        End If

        ' Remove the selection. This allows the same node to be
        ' clicked twice in succession to toggle the expansion state.
        SelectedNode = Nothing
    End Sub

End Class

Hinweise

trueIn diesem Bereich FullRowSelect erstreckt sich eine Auswahlmarkierung über die gesamte Breite der Strukturansicht, anstatt die Breite der Strukturknotenbezeichnung. Die FullRowSelect Eigenschaft wird ignoriert, wenn ShowLines auf true.

Gilt für