TreeView.ShowLines Proprietà

Definizione

Ottiene o imposta un valore che indica se sono visualizzate le linee che collegano nodi figlio a nodi padre.

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

Valore della proprietà

true per visualizzare le linee che collegano i nodi; in caso contrario, false. Il valore predefinito è false.

Esempio

Nell'esempio di codice seguente viene illustrato come utilizzare la ShowLines proprietà per visualizzare le linee che connettono i nodi nel TreeView controllo . Assicurarsi di usare lo strumento Progettazione linee per creare un set di immagini di riga e inserirle in una cartella denominata LineImages all'interno della directory per l'applicazione di esempio.


<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>TreeView LineImagesFolderUrl Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>TreeView LineImagesFolderUrl Example</h3>
      
      <asp:TreeView id="LinksTreeView"
        LineImagesFolder="~\LineImages"
        ShowLines="true" 
        runat="server">
         
        <Nodes>
        
          <asp:TreeNode Text="Table of Contents"
             SelectAction="None">
             
            <asp:TreeNode Text="Chapter One">
            
              <asp:TreeNode Text="Section 1.0">
              
                <asp:TreeNode Text="Topic 1.0.1"/>
                <asp:TreeNode Text="Topic 1.0.2"/>
                <asp:TreeNode Text="Topic 1.0.3"/>
              
              </asp:TreeNode>
              
              <asp:TreeNode Text="Section 1.1">
              
                <asp:TreeNode Text="Topic 1.1.1"/>
                <asp:TreeNode Text="Topic 1.1.2"/>
                <asp:TreeNode Text="Topic 1.1.3"/>
                <asp:TreeNode Text="Topic 1.1.4"/>
              
              </asp:TreeNode>
            
            </asp:TreeNode>
            
            <asp:TreeNode Text="Chapter Two">
            
              <asp:TreeNode Text="Section 2.0">
              
                <asp:TreeNode Text="Topic 2.0.1"/>
                <asp:TreeNode Text="Topic 2.0.2"/>
              
              </asp:TreeNode>
            
            </asp:TreeNode>
            
          </asp:TreeNode>

          <asp:TreeNode Text="Appendix A" />
          <asp:TreeNode Text="Appendix B" />
          <asp:TreeNode Text="Appendix C" />
        
        </Nodes>
        
      </asp:TreeView>

    </form>
  </body>
</html>

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>TreeView LineImagesFolderUrl Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>TreeView LineImagesFolderUrl Example</h3>
      
      <asp:TreeView id="LinksTreeView"
        LineImagesFolder="~\LineImages"
        ShowLines="true" 
        runat="server">
         
        <Nodes>
        
          <asp:TreeNode Text="Table of Contents"
             SelectAction="None">
             
            <asp:TreeNode Text="Chapter One">
            
              <asp:TreeNode Text="Section 1.0">
              
                <asp:TreeNode Text="Topic 1.0.1"/>
                <asp:TreeNode Text="Topic 1.0.2"/>
                <asp:TreeNode Text="Topic 1.0.3"/>
              
              </asp:TreeNode>
              
              <asp:TreeNode Text="Section 1.1">
              
                <asp:TreeNode Text="Topic 1.1.1"/>
                <asp:TreeNode Text="Topic 1.1.2"/>
                <asp:TreeNode Text="Topic 1.1.3"/>
                <asp:TreeNode Text="Topic 1.1.4"/>
              
              </asp:TreeNode>
            
            </asp:TreeNode>
            
            <asp:TreeNode Text="Chapter Two">
            
              <asp:TreeNode Text="Section 2.0">
              
                <asp:TreeNode Text="Topic 2.0.1"/>
                <asp:TreeNode Text="Topic 2.0.2"/>
              
              </asp:TreeNode>
            
            </asp:TreeNode>
            
          </asp:TreeNode>

          <asp:TreeNode Text="Appendix A" />
          <asp:TreeNode Text="Appendix B" />
          <asp:TreeNode Text="Appendix C" />
        
        </Nodes>
        
      </asp:TreeView>

    </form>
  </body>
</html>

Commenti

Utilizzare la ShowLines proprietà per specificare se vengono visualizzate le righe che connettono nodi figlio ai nodi padre. Quando questa proprietà è impostata su true, il TreeView controllo cerca nella cartella accessibile dal Web specificata dalla LineImagesFolder proprietà le immagini della riga.

Nota

Se la LineImagesFolder proprietà non è impostata, il TreeView controllo userà le immagini predefinite predefinite (20 x 20 pixel).

Il valore di questa proprietà viene archiviato nello stato di visualizzazione.

Si applica a

Vedi anche