TreeView.LineImagesFolder 屬性

定義

取得或設定資料夾的路徑,該資料夾包含用於將子節點連接至父節點的線條影像。

public:
 property System::String ^ LineImagesFolder { System::String ^ get(); void set(System::String ^ value); };
public string LineImagesFolder { get; set; }
member this.LineImagesFolder : string with get, set
Public Property LineImagesFolder As String

屬性值

資料夾的路徑,該資料夾包含用於連接節點的線條影像。 預設值是空字串 (""),表示未設定 LineImagesFolder 屬性。

範例

下列程式碼範例示範如何使用 LineImagesFolder 屬性來指定包含控制項中 TreeView 要顯示之線條影像的資料夾。 若要使用此範例,請事先使用線條設計工具來建立一組線條影像。 將它們放在範例應用程式目錄內名為 LineImages 的資料夾。


<%@ 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>

備註

當 屬性設定 true 為 時,控制項 TreeView 可以顯示將子節點連接到父節點的 ShowLines 行。 顯示線條時,請使用 LineImagesFolder 屬性來指定 Web 可存取的資料夾,其中包含要用於線條的預先轉譯影像集。 下表描述 控制項所使用的 TreeView 影像。

映像 描述
Dash.gif 樹狀結構中只有一個根節點且根節點是分葉時,根節點旁邊顯示的線條影像。
Dashminus.gif 當樹狀結構中只有一個根節點,表示根節點已展開時,就會顯示減號 () 影像。
Dashplus.gif 當樹狀結構中只有一個根節點,表示根節點已折迭時,加號 (+) 顯示影像。
I.gif 顯示用來連接相鄰節點的線條影像。
L.gif 當節點是分葉時,分支中最後一個節點旁顯示的線條影像。
Lminus.gif 分支中最後一個節點旁顯示的線條影像,表示節點已展開。
Lplus.gif 分支中最後一個節點旁顯示的線條影像,表示節點已折迭。
Minus.gif 樹狀結構中第一個根節點旁所顯示的減號 () 影像,其中包含多個根節點,表示節點已展開。 此影像不包含額外的一行,而且只會在根節點折迭一次之後顯示。 第一次載入頁面時,會顯示Rminus.gif影像。
Noexpand.gif 分葉節點旁顯示的空白空白字元影像。 此影像允許文字垂直對齊。
Plus.gif 加號 (+) 圖顯示在樹狀結構的第一個根節點旁邊,其中包含多個根節點,表示節點已折迭。 此影像不包含額外的行,而且只會在根節點展開一次之後顯示。 第一次載入頁面時,會顯示Rplus.gif影像。
R.gif 樹狀結構中第一個根節點旁顯示的線條影像,其中包含多個根節點,表示節點是分葉節點。
Rminus.gif 樹狀結構中第一個根節點旁所顯示的減號 () 影像,其中包含多個根節點,表示節點已展開。 此影像包含額外的一行,只有在第一次載入頁面時才會顯示。 一次折迭根節點之後,就會顯示Minus.gif影像。
Rplus.gif 加號 (+) 圖顯示在樹狀結構的第一個根節點旁邊,其中包含多個根節點,表示節點已折迭。 此影像包含額外的一行,只有在第一次載入頁面時才會顯示。 一旦展開根節點之後,就會顯示Plus.gif影像。
T.gif 在 t 交集) 的樹狀結構中間 (節點旁顯示的線條影像,表示節點是分葉。
Tminus.gif 減號 () 影像顯示在樹狀結構中間的節點旁邊, (t 交集) ,表示節點已展開。
Tplus.gif 加號 (+) 影像顯示在樹狀結構中間的節點旁邊, (t 交集) 表示節點已折迭。

注意

LineImagesFolder如果未設定屬性, TreeView 控制項會使用內建的預設影像 (20 x 20 圖元) 。

某些視覺化設計工具,例如 Microsoft Visual Studio,會提供工具來產生線條影像。

執行時間不會翻轉由右至左顯示的自訂影像。 若要支援由左至右和由右至左網頁,您必須為雙向建立影像集。

這個屬性的值會儲存在檢視狀態中。

適用於

另請參閱