# [VB.NET] TreeView.NodeMouseClick 事件迴避 Collapse/Expand ###### 發布日期:2019-12-11 | 存檔日期:2023-06-17 ###### 原文網址:https://bmtnote.blogspot.com/2019/12/vbnet-treeviewnodemouseclick.html Dot Net的TreeView元件如果有開啟checkbox屬性,可以在Before/AfterCheck事件,利用e.Action處理類似的問題。 如果沒有開啟checkbox,一開始只找到在Before/After Collapse加入boolean變數,辨別是否正在執行展開/關閉TreeView動作,但是實測後與NodeMouseClick的觸發順序無法配合。 下面這個方法是可以運作的,也更好理解: ```vb= Dim hit As TreeViewHitTestInfo = TreeView1.HitTest(e.Location) If hit.Location = TreeViewHitTestLocations.PlusMinus Then Return ``` 如果點擊位置在TreeView元件的展開/關閉圖示,則退出Module執行。 ###### tags: `Visual Basic` `blogspot存檔` `Public`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up