TreeViewHitTestInfo.Location 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
public:
property System::Windows::Forms::TreeViewHitTestLocations Location { System::Windows::Forms::TreeViewHitTestLocations get(); };
public System.Windows.Forms.TreeViewHitTestLocations Location { get; }
member this.Location : System.Windows.Forms.TreeViewHitTestLocations
Public ReadOnly Property Location As TreeViewHitTestLocations
属性值
其中一个 TreeViewHitTestLocations 值。
示例
下面的代码示例演示如何使用该 Location 属性。 若要运行此示例,请将以下代码粘贴到包含 TreeView 命名 treeView1控件的 Windows 窗体中,并填充 TreeView 项。 确保treeview1MouseDown窗体的事件与HandleMouseDown该方法相关联。
void HandleMouseDown(object sender, MouseEventArgs e)
{
TreeViewHitTestInfo info = treeView1.HitTest(e.X, e.Y);
if (info != null)
MessageBox.Show("Hit the " + info.Location.ToString());
}
Private Sub HandleMouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) _
Handles Me.MouseDown, treeView1.MouseDown
Dim info As TreeViewHitTestInfo = treeView1.HitTest(e.X, e.Y)
If (info IsNot Nothing) Then
MessageBox.Show("Hit the " + info.Location.ToString())
End If
End Sub