|Why not just use a
ContextMenu, which is already supported? Just start tracking the
ContextMenu in the coordinate space of the container of the
Button so that it aligns properly with the
Button in question. See the
Control.PointToClient method to convert coordinate spaces back and forth. Because the
Button.Location is already in the coordinate space of the container, you could also just add the
Width appropriately, saving you a lot of work. The
ContextMenu control will also extend past the bounds of the container.
Otherwise, you can use a simple popup Window (with the
WS_POPUP style when you consider the native implementation of most controls in the .NET BCL). This is all the
ContextMenu is when you get the heart of it.
-----BEGIN GEEK CODE BLOCK-----
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----