Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

treenode location vb.net

Posted on 2009-04-24
2
Medium Priority
?
428 Views
Last Modified: 2013-12-17
I want to show a form of border style none, under a treenode. I can not place it properly. If I collect e.Location the form is opening at wrong place if i drag the mouse just before the form show event. any suggestion?
0
Comment
Question by:Amitava_Mukherjee
2 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 24226005
How about something like this?
Public Class Form1
 
    Private Sub TreeView1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseDown
        If e.Button = Windows.Forms.MouseButtons.Right Then
            Dim tn As TreeNode = TreeView1.GetNodeAt(e.X, e.Y)
            If Not IsNothing(tn) Then
                Dim rc As Rectangle = TreeView1.RectangleToScreen(tn.Bounds)
                Dim f2 As New Form2
                f2.StartPosition = FormStartPosition.Manual
                f2.Location = New Point(rc.X, rc.Bottom)
                f2.ShowDialog(Me)
            End If
        End If
    End Sub
 
End Class

Open in new window

0
 

Author Closing Comment

by:Amitava_Mukherjee
ID: 31574121
Perfect Solution, Thanx
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question