TreeView 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
显示标记项的分层集合,每个项由一个 TreeNode表示。
public ref class TreeView : System::Windows::Forms::Control
public class TreeView : System.Windows.Forms.Control
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Windows.Forms.Docking(System.Windows.Forms.DockingBehavior.Ask)]
public class TreeView : System.Windows.Forms.Control
[System.Windows.Forms.Docking(System.Windows.Forms.DockingBehavior.Ask)]
public class TreeView : System.Windows.Forms.Control
type TreeView = class
inherit Control
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Windows.Forms.Docking(System.Windows.Forms.DockingBehavior.Ask)>]
type TreeView = class
inherit Control
[<System.Windows.Forms.Docking(System.Windows.Forms.DockingBehavior.Ask)>]
type TreeView = class
inherit Control
Public Class TreeView
Inherits Control
- 继承
- 派生
- 属性
示例
下面的代码示例演示了控件 TreeView 的使用。
// Populates a TreeView control with example nodes.
private void InitializeTreeView()
{
treeView1.BeginUpdate();
treeView1.Nodes.Add("Parent");
treeView1.Nodes[0].Nodes.Add("Child 1");
treeView1.Nodes[0].Nodes.Add("Child 2");
treeView1.Nodes[0].Nodes[1].Nodes.Add("Grandchild");
treeView1.Nodes[0].Nodes[1].Nodes[0].Nodes.Add("Great Grandchild");
treeView1.EndUpdate();
}
' Populates a TreeView control with example nodes.
Private Sub InitializeTreeView()
treeView1.BeginUpdate()
treeView1.Nodes.Add("Parent")
treeView1.Nodes(0).Nodes.Add("Child 1")
treeView1.Nodes(0).Nodes.Add("Child 2")
treeView1.Nodes(0).Nodes(1).Nodes.Add("Grandchild")
treeView1.Nodes(0).Nodes(1).Nodes(0).Nodes.Add("Great Grandchild")
treeView1.EndUpdate()
End Sub
以下更复杂的代码示例在控件中 TreeView 显示客户信息。 根树节点显示客户名称,子树节点显示分配给每个客户的订单编号。 在此示例中,将显示 1,000 个客户,每个订单 15 个。 通过使用和方法取消重新绘制TreeView,创建和绘制TreeNode对象时TreeView会显示等待Cursor。EndUpdateBeginUpdate 此示例要求你有一个 Customer 可以保存对象集合 Order 的对象。 它还要求你有一个游标文件,该文件在应用程序目录中命名MyWait.cur,并且已在应用程序Form目录中创建了控件的TreeView实例。
// The basic Customer class.
ref class Customer: public System::Object
{
private:
String^ custName;
protected:
ArrayList^ custOrders;
public:
Customer( String^ customername )
{
custName = "";
custOrders = gcnew ArrayList;
this->custName = customername;
}
property String^ CustomerName
{
String^ get()
{
return this->custName;
}
void set( String^ value )
{
this->custName = value;
}
}
property ArrayList^ CustomerOrders
{
ArrayList^ get()
{
return this->custOrders;
}
}
};
// End Customer class
// The basic customer Order class.
ref class Order: public System::Object
{
private:
String^ ordID;
public:
Order( String^ orderid )
{
ordID = "";
this->ordID = orderid;
}
property String^ OrderID
{
String^ get()
{
return this->ordID;
}
void set( String^ value )
{
this->ordID = value;
}
}
};
// End Order class
void FillMyTreeView()
{
// Add customers to the ArrayList of Customer objects.
for ( int x = 0; x < 1000; x++ )
{
customerArray->Add( gcnew Customer( "Customer " + x ) );
}
// Add orders to each Customer object in the ArrayList.
IEnumerator^ myEnum = customerArray->GetEnumerator();
while ( myEnum->MoveNext() )
{
Customer^ customer1 = safe_cast<Customer^>(myEnum->Current);
for ( int y = 0; y < 15; y++ )
{
customer1->CustomerOrders->Add( gcnew Order( "Order " + y ) );
}
}
// Display a wait cursor while the TreeNodes are being created.
::Cursor::Current = gcnew System::Windows::Forms::Cursor( "MyWait.cur" );
// Suppress repainting the TreeView until all the objects have been created.
treeView1->BeginUpdate();
// Clear the TreeView each time the method is called.
treeView1->Nodes->Clear();
// Add a root TreeNode for each Customer object in the ArrayList.
myEnum = customerArray->GetEnumerator();
while ( myEnum->MoveNext() )
{
Customer^ customer2 = safe_cast<Customer^>(myEnum->Current);
treeView1->Nodes->Add( gcnew TreeNode( customer2->CustomerName ) );
// Add a child treenode for each Order object in the current Customer object.
IEnumerator^ myEnum = customer2->CustomerOrders->GetEnumerator();
while ( myEnum->MoveNext() )
{
Order^ order1 = safe_cast<Order^>(myEnum->Current);
treeView1->Nodes[ customerArray->IndexOf( customer2 ) ]->Nodes->Add( gcnew TreeNode( customer2->CustomerName + "." + order1->OrderID ) );
}
}
// Reset the cursor to the default for all controls.
::Cursor::Current = Cursors::Default;
// Begin repainting the TreeView.
treeView1->EndUpdate();
}
// The basic Customer class.
public class Customer : System.Object
{
private string custName = "";
protected ArrayList custOrders = new ArrayList();
public Customer(string customername)
{
this.custName = customername;
}
public string CustomerName
{
get{return this.custName;}
set{this.custName = value;}
}
public ArrayList CustomerOrders
{
get{return this.custOrders;}
}
} // End Customer class
// The basic customer Order class.
public class Order : System.Object
{
private string ordID = "";
public Order(string orderid)
{
this.ordID = orderid;
}
public string OrderID
{
get{return this.ordID;}
set{this.ordID = value;}
}
} // End Order class
// Create a new ArrayList to hold the Customer objects.
private ArrayList customerArray = new ArrayList();
private void FillMyTreeView()
{
// Add customers to the ArrayList of Customer objects.
for(int x=0; x<1000; x++)
{
customerArray.Add(new Customer("Customer" + x.ToString()));
}
// Add orders to each Customer object in the ArrayList.
foreach(Customer customer1 in customerArray)
{
for(int y=0; y<15; y++)
{
customer1.CustomerOrders.Add(new Order("Order" + y.ToString()));
}
}
// Display a wait cursor while the TreeNodes are being created.
Cursor.Current = new Cursor("MyWait.cur");
// Suppress repainting the TreeView until all the objects have been created.
treeView1.BeginUpdate();
// Clear the TreeView each time the method is called.
treeView1.Nodes.Clear();
// Add a root TreeNode for each Customer object in the ArrayList.
foreach(Customer customer2 in customerArray)
{
treeView1.Nodes.Add(new TreeNode(customer2.CustomerName));
// Add a child treenode for each Order object in the current Customer object.
foreach(Order order1 in customer2.CustomerOrders)
{
treeView1.Nodes[customerArray.IndexOf(customer2)].Nodes.Add(
new TreeNode(customer2.CustomerName + "." + order1.OrderID));
}
}
// Reset the cursor to the default for all controls.
Cursor.Current = Cursors.Default;
// Begin repainting the TreeView.
treeView1.EndUpdate();
}
Public Class Customer
Inherits [Object]
Private custName As String = ""
Friend custOrders As New ArrayList()
Public Sub New(ByVal customername As String)
Me.custName = customername
End Sub
Public Property CustomerName() As String
Get
Return Me.custName
End Get
Set(ByVal Value As String)
Me.custName = Value
End Set
End Property
Public ReadOnly Property CustomerOrders() As ArrayList
Get
Return Me.custOrders
End Get
End Property
End Class
Public Class Order
Inherits [Object]
Private ordID As String
Public Sub New(ByVal orderid As String)
Me.ordID = orderid
End Sub
Public Property OrderID() As String
Get
Return Me.ordID
End Get
Set(ByVal Value As String)
Me.ordID = Value
End Set
End Property
End Class
' Create a new ArrayList to hold the Customer objects.
Private customerArray As New ArrayList()
Private Sub FillMyTreeView()
' Add customers to the ArrayList of Customer objects.
Dim x As Integer
For x = 0 To 999
customerArray.Add(New Customer("Customer" + x.ToString()))
Next x
' Add orders to each Customer object in the ArrayList.
Dim customer1 As Customer
For Each customer1 In customerArray
Dim y As Integer
For y = 0 To 14
customer1.CustomerOrders.Add(New Order("Order" + y.ToString()))
Next y
Next customer1
' Display a wait cursor while the TreeNodes are being created.
Cursor.Current = New Cursor("MyWait.cur")
' Suppress repainting the TreeView until all the objects have been created.
treeView1.BeginUpdate()
' Clear the TreeView each time the method is called.
treeView1.Nodes.Clear()
' Add a root TreeNode for each Customer object in the ArrayList.
Dim customer2 As Customer
For Each customer2 In customerArray
treeView1.Nodes.Add(New TreeNode(customer2.CustomerName))
' Add a child TreeNode for each Order object in the current Customer object.
Dim order1 As Order
For Each order1 In customer2.CustomerOrders
treeView1.Nodes(customerArray.IndexOf(customer2)).Nodes.Add( _
New TreeNode(customer2.CustomerName + "." + order1.OrderID))
Next order1
Next customer2
' Reset the cursor to the default for all controls.
Cursor.Current = System.Windows.Forms.Cursors.Default
' Begin repainting the TreeView.
treeView1.EndUpdate()
End Sub
注解
集合Nodes保存分配给TreeView控件的所有TreeNode对象。 此集合中的树节点称为根树节点。 随后添加到根树节点的任何树节点称为子节点。 由于每个 TreeNode 对象都可以包含其他 TreeNode 对象的集合,因此在循环访问集合时,你可能会发现很难确定树结构中的位置。 可以使用字符串值来分析 TreeNode.FullPath 字符串 PathSeparator ,以确定标签的开始和结束位置 TreeNode 。
可以通过向属性分配ImageListImageList属性并引用要分配Image的ImageImageList索引值来显示树节点旁边的图像。 使用以下属性分配图像:
将 ImageIndex 属性设置为未选择树节点时要显示的索引值 Image 。
将 SelectedImageIndex 属性设置为在选择树节点时要显示的索引值 Image 。
所 ImageIndex 引用的图像和 SelectedImageIndex 属性值是分配给 Nodes 集合的所有树节点显示的默认图像。 单个树节点可以通过设置 TreeNode.ImageIndex 和 TreeNode.SelectedImageIndex 属性来替代默认图像。
默认情况下, TreeView 显示的状态图像为 16 x 16 像素。 ImageSize设置属性StateImageList不会影响图像的显示方式。 但是,当 app.config 文件包含以下条目时,状态图像会根据系统 DPI 设置调整大小:
<appSettings>
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
</appSettings>
可以展开树节点以显示下一级别的子树节点。 用户可以通过单击加号(+)按钮来展开TreeNode该按钮(如果旁边显示TreeNode一个),也可以通过调用TreeNode.Expand该方法来展开TreeNode该按钮。 若要展开集合中的所有 Nodes 子树节点级别,请调用 ExpandAll 该方法。 可以通过调用TreeNode.Collapse方法折叠子TreeNode级别,或者用户可以按减号(-)按钮(如果旁边显示TreeNode一个)。 还可以调用 TreeNode.Toggle 该方法以在展开状态和折叠状态之间交替。
树节点可以选择显示复选框。 若要显示复选框,请将该属性TreeView设置为 CheckBoxestrue。 该 Checked 属性设置为 true 处于选中状态的树节点。
注释
从TreeNode.Checked或AfterCheck事件中BeforeCheck设置属性会导致事件多次引发,并可能导致意外行为。 例如,在以递归方式更新子节点时,可以在事件处理程序中设置 Checked 属性,以便用户不必单独展开和检查每个节点。 若要防止多次引发该事件,请将逻辑添加到事件处理程序中,仅当属性未设置为 Action 时TreeViewEventArgsTreeViewAction.Unknown,才会执行递归代码。 有关如何执行此操作的示例,请参阅或BeforeCheck事件的“示例”部分AfterCheck。
可以通过设置控件的某些 TreeView 显示和样式属性来更改控件的外观。 设置为ShowPlusMinustrue在可以展开或折叠的每个TreeNode加号或减号按钮旁边显示一个加号或减号按钮。 设置 ShowRootLines 属性可 true 导致 TreeView 显示将所有根树节点联接在一起的行。 通过将属性true设置为 ,可以显示将子树节点连接到其根节点的ShowLines行。 设置属性 HotTracking 以 true 更改树节点标签的外观,因为鼠标指针将鼠标指针传递到树节点标签上。 热跟踪时,树节点标签会呈现超链接的外观。 还可以完全自定义控件的外观 TreeView 。 为此,请将 DrawMode 属性设置为除该事件以外的 TreeViewDrawMode.Normal 值并处理 DrawNode 该事件。
注释
在运行时设置 CheckBoxes、ScrollableImageIndex属性和SelectedImageIndex属性时,TreeView将重新创建句柄(请参阅Control.RecreateHandle)以更新控件的外观。 这会导致所有树节点都折叠,但所选 TreeNode节点除外。
构造函数
| 名称 | 说明 |
|---|---|
| TreeView() |
初始化 TreeView 类的新实例。 |
属性
| 名称 | 说明 |
|---|---|
| AccessibilityObject |
AccessibleObject获取分配给控件的控件。 (继承自 Control) |
| AccessibleDefaultActionDescription |
获取或设置控件的默认操作说明,以供辅助功能客户端应用程序使用。 (继承自 Control) |
| AccessibleDescription |
获取或设置辅助功能客户端应用程序使用的控件的说明。 (继承自 Control) |
| AccessibleName |
获取或设置辅助功能客户端应用程序使用的控件的名称。 (继承自 Control) |
| AccessibleRole |
获取或设置控件的可访问角色。 (继承自 Control) |
| AllowDrop |
获取或设置一个值,该值指示控件是否可以接受用户拖动到其中的数据。 (继承自 Control) |
| Anchor |
获取或设置控件绑定到的容器的边缘,并确定控件的父级如何调整其大小。 (继承自 Control) |
| AutoScrollOffset |
获取或设置此控件滚动到的位置 ScrollControlIntoView(Control)。 (继承自 Control) |
| AutoSize |
此属性与此类无关。 (继承自 Control) |
| BackColor |
获取或设置控件的背景色。 |
| BackgroundImage |
获取或设置控件的背景图像 TreeView 。 |
| BackgroundImageLayout |
获取或设置控件的背景图像的 TreeView 布局。 |
| BindingContext |
获取或设置 BindingContext 控件。 (继承自 Control) |
| BorderStyle |
获取或设置树视图控件的边框样式。 |
| Bottom |
获取控件的下边缘与其容器工作区的上边缘之间的距离(以像素为单位)。 (继承自 Control) |
| Bounds |
获取或设置控件的大小和位置,包括其相对于父控件的非client 元素(以像素为单位)。 (继承自 Control) |
| CanEnableIme |
获取一个值,该值指示属性是否可以 ImeMode 设置为活动值,以启用 IME 支持。 (继承自 Control) |
| CanFocus |
获取一个值,该值指示控件是否可以接收焦点。 (继承自 Control) |
| CanRaiseEvents |
确定是否可以在控件上引发事件。 (继承自 Control) |
| CanSelect |
获取一个值,该值指示是否可以选择控件。 (继承自 Control) |
| Capture |
获取或设置一个值,该值指示控件是否已捕获鼠标。 (继承自 Control) |
| CausesValidation |
获取或设置一个值,该值指示控件是否导致验证在收到焦点时需要验证的任何控件上执行。 (继承自 Control) |
| CheckBoxes |
获取或设置一个值,该值指示是否在树视图控件中的树节点旁边显示复选框。 |
| ClientRectangle |
获取表示控件工作区的矩形。 (继承自 Control) |
| ClientSize |
获取或设置控件工作区的高度和宽度。 (继承自 Control) |
| CompanyName |
获取包含控件的应用程序的公司或创建者的名称。 (继承自 Control) |
| Container |
IContainer获取包含 .Component (继承自 Component) |
| ContainsFocus |
获取一个值,该值指示控件或其子控件之一当前是否具有输入焦点。 (继承自 Control) |
| ContextMenu |
已过时.
获取或设置与控件关联的快捷菜单。 (继承自 Control) |
| ContextMenuStrip |
获取或设置 ContextMenuStrip 与此控件关联的值。 (继承自 Control) |
| Controls |
获取控件中包含的控件的集合。 (继承自 Control) |
| Created |
获取一个值,该值指示是否已创建控件。 (继承自 Control) |
| CreateParams |
获取创建控件句柄时所需的创建参数。 |
| Cursor |
获取或设置鼠标指针位于控件上时显示的光标。 (继承自 Control) |
| DataBindings |
获取控件的数据绑定。 (继承自 Control) |
| DataContext |
获取或设置用于数据绑定的数据上下文。 这是一个环境属性。 (继承自 Control) |
| DefaultCursor |
获取或设置控件的默认游标。 (继承自 Control) |
| DefaultImeMode |
获取控件支持的默认输入法编辑器 (IME) 模式。 (继承自 Control) |
| DefaultMargin |
获取默认情况下在控件之间指定的空间(以像素为单位)。 (继承自 Control) |
| DefaultMaximumSize |
获取指定为控件的默认最大大小的长度和高度(以像素为单位)。 (继承自 Control) |
| DefaultMinimumSize |
获取指定为控件的默认最小大小的长度和高度(以像素为单位)。 (继承自 Control) |
| DefaultPadding |
获取控件内容的默认内部间距(以像素为单位)。 (继承自 Control) |
| DefaultSize |
获取控件的默认大小。 |
| DesignMode |
获取一个值,该值指示当前是否 Component 处于设计模式。 (继承自 Component) |
| DeviceDpi |
获取当前显示控件的显示设备的 DPI 值。 (继承自 Control) |
| DisplayRectangle |
获取表示控件的显示区域的矩形。 (继承自 Control) |
| Disposing |
获取一个值,该值指示基 Control 类是否正在处理。 (继承自 Control) |
| Dock |
获取或设置哪些控件边框停靠到其父控件,并确定控件如何调整其父级的大小。 (继承自 Control) |
| DoubleBuffered |
获取或设置一个值,该值指示控件是否应使用辅助缓冲区重新绘制其图面。 该 DoubleBuffered 属性不会影响 TreeView 控件。 |
| DrawMode |
获取或设置在其中绘制控件的模式。 |
| Enabled |
获取或设置一个值,该值指示控件是否可以响应用户交互。 (继承自 Control) |
| Events |
获取附加到此 Component对象的事件处理程序的列表。 (继承自 Component) |
| Focused |
获取一个值,该值指示控件是否具有输入焦点。 (继承自 Control) |
| Font |
获取或设置控件显示的文本的字体。 (继承自 Control) |
| FontHeight |
获取或设置控件字体的高度。 (继承自 Control) |
| ForeColor |
获取或设置控件的前景色。 |
| FullRowSelect |
获取或设置一个值,该值指示选择突出显示是否跨越树视图控件的宽度。 |
| Handle |
获取控件绑定到的窗口句柄。 (继承自 Control) |
| HasChildren |
获取一个值,该值指示控件是否包含一个或多个子控件。 (继承自 Control) |
| Height |
获取或设置控件的高度。 (继承自 Control) |
| HideSelection |
获取或设置一个值,该值指示即使树视图失去焦点,所选树节点是否仍保持突出显示状态。 |
| HotTracking |
获取或设置一个值,该值指示当鼠标指针经过超链接时树节点标签是否采用超链接的外观。 |
| ImageIndex |
获取或设置树节点显示的默认图像的图像列表索引值。 |
| ImageKey |
获取或设置控件中 TreeView 每个节点处于未选择状态时的默认映像的键。 |
| ImageList | |
| ImeMode |
获取或设置控件的输入法编辑器 (IME) 模式。 (继承自 Control) |
| ImeModeBase |
获取或设置控件的 IME 模式。 (继承自 Control) |
| Indent |
获取或设置缩进每个子树节点级别的距离。 |
| InvokeRequired |
获取一个值,该值指示调用方在对控件进行方法调用时是否必须调用调用方法,因为调用方与创建控件的线程不同。 (继承自 Control) |
| IsAccessible |
获取或设置一个值,该值指示控件是否对辅助功能应用程序可见。 (继承自 Control) |
| IsAncestorSiteInDesignMode |
指示此控件的上级位置之一是否位于 DesignMode 中。 此属性为只读。 (继承自 Control) |
| IsDisposed |
获取一个值,该值指示控件是否已释放。 (继承自 Control) |
| IsHandleCreated |
获取一个值,该值指示控件是否具有与之关联的句柄。 (继承自 Control) |
| IsMirrored |
获取一个值,该值指示控件是否镜像。 (继承自 Control) |
| ItemHeight |
获取或设置树视图控件中每个树节点的高度。 |
| LabelEdit |
获取或设置一个值,该值指示是否可以编辑树节点的标签文本。 |
| LayoutEngine |
获取控件布局引擎的缓存实例。 (继承自 Control) |
| Left |
获取或设置控件左边缘与其容器工作区的左边缘之间的距离(以像素为单位)。 (继承自 Control) |
| LineColor |
获取或设置连接控件节点的 TreeView 线条的颜色。 |
| Location |
获取或设置控件左上角相对于其容器左上角的坐标。 (继承自 Control) |
| Margin |
获取或设置控件之间的间距。 (继承自 Control) |
| MaximumSize |
获取或设置可指定上限 GetPreferredSize(Size) 的大小。 (继承自 Control) |
| MinimumSize |
获取或设置可以指定的下限 GetPreferredSize(Size) 的大小。 (继承自 Control) |
| Name |
获取或设置控件的名称。 (继承自 Control) |
| Nodes |
获取分配给树视图控件的树节点的集合。 |
| Padding |
获取或设置控件内容与其边缘之间的 TreeView 间距。 |
| Parent |
获取或设置控件的父容器。 (继承自 Control) |
| PathSeparator |
获取或设置树节点路径使用的分隔符字符串。 |
| PreferredSize |
获取控件可以容纳到的矩形区域的大小。 (继承自 Control) |
| ProductName |
获取包含控件的程序集的产品名称。 (继承自 Control) |
| ProductVersion |
获取包含控件的程序集的版本。 (继承自 Control) |
| RecreatingHandle |
获取一个值,该值指示控件当前是否正在重新创建其句柄。 (继承自 Control) |
| Region |
获取或设置与控件关联的窗口区域。 (继承自 Control) |
| RenderRightToLeft |
已过时.
已过时.
此属性现已过时。 (继承自 Control) |
| ResizeRedraw |
获取或设置一个值,该值指示控件在调整大小时是否重新绘制自身。 (继承自 Control) |
| Right |
获取控件右边缘与其容器工作区的左边缘之间的距离(以像素为单位)。 (继承自 Control) |
| RightToLeft |
获取或设置一个值,该值指示控件的元素是否对齐以支持使用从右到左字体的区域设置。 (继承自 Control) |
| RightToLeftLayout |
获取或设置一个值,该值指示是否 TreeView 应从右向左布局。 |
| ScaleChildren |
获取一个值,该值确定子控件的缩放。 (继承自 Control) |
| Scrollable |
获取或设置一个值,该值指示是否需要树视图控件时是否显示滚动条。 |
| SelectedImageIndex |
获取或设置选择树节点时显示的图像的图像列表索引值。 |
| SelectedImageKey |
获取或设置处于选定状态时 TreeNode 显示的默认图像的键。 |
| SelectedNode |
获取或设置树视图控件中当前选定的树节点。 |
| ShowFocusCues |
获取一个值,该值指示控件是否应显示焦点矩形。 (继承自 Control) |
| ShowKeyboardCues |
获取一个值,该值指示用户界面是否处于适当的状态以显示或隐藏键盘加速器。 (继承自 Control) |
| ShowLines |
获取或设置一个值,该值指示是否在树视图控件中的树节点之间绘制线条。 |
| ShowNodeToolTips |
获取或设置一个值,该值指示鼠标指针悬停在 a TreeNode上时显示工具提示。 |
| ShowPlusMinus |
获取或设置一个值,该值指示是否在包含子树节点的树节点旁边显示加号 (+) 和减号 (-) 按钮。 |
| ShowRootLines |
获取或设置一个值,该值指示是否在树视图根目录的树节点之间绘制线条。 |
| Site |
获取或设置控件的站点。 (继承自 Control) |
| Size |
获取或设置控件的高度和宽度。 (继承自 Control) |
| Sorted |
获取或设置一个值,该值指示树视图中的树节点是否排序。 |
| StateImageList |
获取或设置用于指示其节点的状态 TreeView 的图像列表。 |
| TabIndex |
获取或设置控件在其容器中的 Tab 键顺序。 (继承自 Control) |
| TabStop |
获取或设置一个值,该值指示用户是否可以使用 TAB 键向此控件提供焦点。 (继承自 Control) |
| Tag |
获取或设置包含有关控件的数据的对象。 (继承自 Control) |
| Text |
获取或设置 . 的文本 TreeView。 |
| Top |
获取或设置控件上边缘与其容器工作区上边缘之间的距离(以像素为单位)。 (继承自 Control) |
| TopLevelControl |
获取其他 Windows 窗体控件未父控件的父控件。 通常,这是控件包含在的最外层 Form 。 (继承自 Control) |
| TopNode |
获取或设置树视图控件中第一个完全可见的树节点。 |
| TreeViewNodeSorter | |
| UseWaitCursor |
获取或设置一个值,该值指示是否对当前控件和所有子控件使用等待游标。 (继承自 Control) |
| Visible |
获取或设置一个值,该值指示是否显示控件及其所有子控件。 (继承自 Control) |
| VisibleCount |
获取树视图控件中可完全可见的树节点数。 |
| Width |
获取或设置控件的宽度。 (继承自 Control) |
| WindowTarget |
此属性与此类无关。 (继承自 Control) |
方法
活动
显式接口实现
| 名称 | 说明 |
|---|---|
| IDropTarget.OnDragDrop(DragEventArgs) |
引发 DragDrop 事件。 (继承自 Control) |
| IDropTarget.OnDragEnter(DragEventArgs) |
引发 DragEnter 事件。 (继承自 Control) |
| IDropTarget.OnDragLeave(EventArgs) |
引发 DragLeave 事件。 (继承自 Control) |
| IDropTarget.OnDragOver(DragEventArgs) |
引发 DragOver 事件。 (继承自 Control) |