The attached program has a small bug when you right click on an item. The first time you right click any item it'll throw the context menu (it's the same menu under File) all the way up to the top left of the screen, but the second time you right click it'll appear in the right spot. It only does this once. Why would it be doing this? How can I fix it? :?:

Here is the code that runs when you right click.

private void FileBrowser_MouseClick(object sender, MouseEventArgs e)
        {
            FileBrowser.Update();

            if (e.Button == MouseButtons.Right)
            {
                //Show it relative to the FileBrowser at the location of the mouse
                FileContextMenu.Show(FileBrowser, e.Location);
            }
        }

What I got from that was to assign the context menu to the control on right click.
That made it a little better but created a new problem. The menu isn't thrown to the top left of the screen anymore, instead it shows up under the File button on the first click. It also shows up wherever I click in the ListView. I need it to show up only when an item is right clicked.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.