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