Reputation: 149
I'm trying make a contextMenuStrip with Notify Icon, But I can't put the location of this Context above the mouse Position. it's show at same position mouse
Context menu strip position Image
private void ntfy2_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
contextMenuStrip1.Show(Cursor.Position.X, Cursor.Position.Y); //Show at Postion Mouse
}
}
Upvotes: 2
Views: 151
Reputation: 453
Does this code help you?
private void ntfy2_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
var relativeClickedPosition = e.Location;
var screenClickedPosition = (sender as Control).PointToScreen(relativeClickedPosition);
contextMenuStrip1.Show(screenClickedPosition);
}
}
@DuckFterminal if my post helped you enough, please click on bird of acceptance, ok? :)
Upvotes: 1