I work with Visual Studio 2022 and .Net 6. I'm trying to make a control with Verbs. If I press the right mouse button on the control in the designer, there should be a menu The code I found on the page below should do this.
https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.design.designerverb?view=net-6.0
- I first created a.net 6 Windows Forms App
- And then I added a Windows Forms class library to the solution.
- I copied and pasted the code on the page above into the class in the class library.
- Then I saved everything.
- Then I close all tabs and do clean and build.
- When the designer of the form(of the windows forms app) is open then I see the control in the toolbox
- I put the new control on the form and press the right mouse button when my mousepointer is on the control but the verbs don't come into view. What am I doing wrong.
I expect verbs to be displayed in the popup menu of the control, But they don't become visible. Below you can see the code that is relevant for me:
m_Verbs = new DesignerVerbCollection();
m_Verbs.Add( new DesignerVerb("First Designer Verb", new EventHandler(OnFirstItemSelected)) );
m_Verbs.Add( new DesignerVerb("Second Designer Verb", new EventHandler(OnSecondItemSelected)) );