How to make a floating control

.net, c#, winforms

Solution

You want a Form with it's FormBorderStyle set to None, if you want it to behave like a context menu then you'll need to tie showing it to the appropriate event handler in your main form. Simple example below of setting the location and calling show from a mouse click event handler.

MyForm form = new MyForm();
form.Location = PointToScreen(new Point(e.X, e.Y));
form.Show();

Problem

I would like to create a control the floats (potentially) outside the bounds of it's containing form. Is this possible? How may I do it? This would function much like Context Menu's only I need to be able to add other controls to it such as buttons and images.

Original source