Solved

Open form at location over a TreeView

Posted on 2014-10-14
2
120 Views
Last Modified: 2014-10-18
Hi

I am trying to open a windows form at a point over a TreeView
How do I do this?
I tried using the following line to load my form at the point where my mouse is but that didn't work
 Form1.Location = Me.PointToClient(System.Windows.Forms.Cursor.Position)
Form1.show
0
Comment
Question by:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 25

Accepted Solution

by:
SStory earned 500 total points
ID: 40380942
    Private Sub TreeView1_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseUp
        Dim f As New Form2
        f.StartPosition = FormStartPosition.Manual
        f.Location = f.PointToScreen(New Point(Me.Location.X + e.X, Me.Location.Y + e.Y))
        f.Show()

    End Sub

Open in new window


You have to be sure to set FormStartPosition to Manual. You'll also probably want to declare the second form variable at the module level, but this should do it.
0
 

Author Closing Comment

by:Murray Brown
ID: 40389205
thanks
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

635 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