I have inherited some C# source code written in Visual Studio 2010 targeting the .NET 2.0 framework. It comprises a simple Windows Forms application with a single form as its user interface.
The form contains a number of menu items, one of which allows the user to preview an image (acquired from a camera). An example of the program output is shown below, with the dark rectangle being the image.
I wish to rewrite the application from scratch for the .NET 4.6.2 Framework using Visual Studio 2019.
Recreating the form is straightforward. However, the component MenuItem used for .NET 2.0 in VS2010 has been replaced by MenuStrip and ToolStripMenuItem in VS2019. When I build the updated version of the application, I can't make the menu strip operate in the same way. My output looks as shown below when the application runs.
NET4.6.2 Windows Form (VS2019)
As you can see, the top level menus are accessible but not visible. How can I locate the workspace image below the MenuStrip?
I am hoping that the answer will be some MenuStrip setting in Visual Studio's 'Properties' dialog box that I have overlooked.
Here's how the Properties currently appear in Form1.Designer.cs:
// mainMenu1
//
this.mainMenu1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuFile,
this.menuView,
this.menuSet,
this.menuDLL,
this.menuDevice});
this.mainMenu1.Location = new System.Drawing.Point(0, 0);
this.mainMenu1.Name = "mainMenu1";
this.mainMenu1.Size = new System.Drawing.Size(641, 24);
this.mainMenu1.TabIndex = 0;
this.mainMenu1.Text = "menuMenu1";
For anyone who may be interested in this problem, I didn't solve it but managed to find a workaround by offsetting the image by +25 along the y-axis.
I didn't use the WinForm Properties to do this. The code that I have inherited uses a third party dll to create the preview. I'm not sure how the dll handles the window size and positioning but I think that it overrides any WinForm property that I try to apply.
Sorry that my answer doesn't help those looking to solve their own version of this problem.