Freigeben über


TreeView.FullRowSelect Eigenschaft

Definition

Dient zum Abrufen oder Festlegen eines Werts, der angibt, ob die Markierungsmarkierung die Breite des Strukturansicht-Steuerelements überspannt.

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

truewenn die Markierungsmarkierung die Breite des Strukturansichtssteuerelements überspannt; andernfalls . false Der Standardwert lautet false.

Beispiele

Das folgende Codebeispiel veranschaulicht eine angepasste TreeView. Durch das 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 false festgelegt ist, überschreibt das angepasste Steuerelement auch die OnAfterSelect Methode, sodass Knoten erweitert und reduziert werden können, wenn auf sie geklickt werden.

Ein Steuerelement, das auf diese Weise angepasst wird, kann in der gesamten Organisation verwendet werden, sodass 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

Wenn FullRowSelect dies der Grund ist true, erstreckt sich eine Auswahlmarkierung über die gesamte Breite der Strukturansicht und nicht über die Breite der Strukturknotenbezeichnung. Die FullRowSelect Eigenschaft wird ignoriert, wenn ShowLines sie auf true.

Gilt für: