TreeView.ShowLines Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan atau menetapkan nilai yang menunjukkan apakah baris yang menghubungkan simpul anak ke simpul induk ditampilkan.
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
Nilai Properti
true untuk menampilkan garis yang menghubungkan simpul; jika tidak, false. Defaultnya adalah false.
Contoh
Contoh kode berikut menunjukkan cara menggunakan ShowLines properti untuk menampilkan baris yang menghubungkan simpul dalam TreeView kontrol. Pastikan untuk menggunakan alat Line Designer untuk membuat sekumpulan gambar garis dan menempatkannya di folder bernama LineImages dalam direktori untuk aplikasi sampel.
<%@ 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>
Keterangan
ShowLines Gunakan properti untuk menentukan apakah baris yang menghubungkan simpul anak ke simpul induk ditampilkan. Ketika properti ini diatur ke true, TreeView kontrol mencari folder yang dapat diakses Web yang ditentukan oleh LineImagesFolder properti untuk gambar baris.
Nota
LineImagesFolder Jika properti tidak diatur, TreeView kontrol akan menggunakan gambar default bawaan (20 x 20 piksel).
Nilai properti ini disimpan dalam status tampilan.