Question Context Menu Strip

oktaysenvar

New member
Joined
Nov 12, 2021
Messages
1
Programming Experience
Beginner
I am on a self study on C#

I started a new form trying to experiment with color and font dialogs. I added a context menu strip with 3 options; color.... font... and exit
I also added a label with text on label to test the color and fonts option. I understand that doing so would enable me to right click on anywhere on the form would allow me to select font or color options. I have completed al and when run right clicking anywhere did not work. also I don't see any menu options.
Any help will be greatly appreciated
Oktay
 
Moving to WinForms...
 
Without seeing your code, it's going to be hard to pinpoint anything. Just with your description it sounds like the context menu may not have been attached to the right UI element.
 
Just adding the ContextMenuStrip to the form in the designer is not enough. If you want that menu to appear when you right-click a control then you need to assign that ContextMenuStrip object to the ContextMenuStrip property of that control. You do that in the Properties window, just like any other property. The form itself is a control like any other.
 
Back
Top Bottom