Hi
I add a UserControl(UserControl1) with a button(button1)into my form1.
And put your code in the button1_Click event of the UserControl1, I click the button once and the menu is displayed.
Here is a code example:
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
ContextMenuStrip buttonMenu = new ContextMenuStrip();
buttonMenu.Items.Clear();
buttonMenu.Items.Add("Item A");
buttonMenu.Items.Add("Item B");
buttonMenu.Items.Add("Item C");
buttonMenu.Show(button1, new Point(0, button1.Height));
}
}
If I misunderstand, please explain in detail or provide some code to reproduce the situation.
Best Regards,
Daniel Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.