MenuStrip不允许创建菜单

时间:2020-08-19 17:48:20

标签: c# winforms .net-core visual-studio-2019

我正在使用Visual Studio 2019,并且创建了一个Windows窗体应用程序项目。在窗体中,当我放下MenuStrip时,没有在此处显示用于创建菜单的Type框。我搜索了互联网,但没有任何解决方案。谁能帮我这个?预先感谢。

See image here

// Form1.Designer.cs

namespace asg_gui_F
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.menuStrip1 = new System.Windows.Forms.MenuStrip();
            this.SuspendLayout();
            // 
            // menuStrip1
            // 
            this.menuStrip1.Location = new System.Drawing.Point(0, 0);
            this.menuStrip1.Name = "menuStrip1";
            this.menuStrip1.Size = new System.Drawing.Size(800, 24);
            this.menuStrip1.TabIndex = 0;
            this.menuStrip1.Text = "menuStrip1";
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(800, 450);
            this.Controls.Add(this.menuStrip1);
            this.Name = "Form1";
            this.Text = "Form1";
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.MenuStrip menuStrip1;
    }
}

5 个答案:

答案 0 :(得分:2)

确保在创建项目时选择“Windows Forms App (.Net Framework)”,您将看到“在此处键入”。

答案 1 :(得分:1)

想通了 在创建表单时使用 .netframework 而不是使用核心

答案 2 :(得分:1)

这个问题已经修复 在 Visual Studio 最新版本 v16.10: 05/25/2021 (https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes) 中。我已经在 net 5(当前)和 net core 3.1 (LTS) 中对此进行了测试。

演示: https://youtu.be/3s55hWrHx4U

Project setup Image proof

答案 3 :(得分:0)

这个问题一般出现在visual basic studio的最新版本中,比如visual studio community edition 2019。请在VB 2019中执行以下步骤。

  1. 从工具箱中拖放 MenuStrip
  2. 右键单击菜单条项目 -> 编辑 -> 单击添加 -> 更改文本属性的名称(例如:MyTest 菜单)
  3. 向下滚动到 [DATA] 属性 -->双击下拉项目属性
  4. 点击添加(将添加工具条菜单项)->
  5. 更改子项对应的[text]属性。

答案 4 :(得分:-2)

  • 点击新项目。
  • 然后点击所有语言
  • 然后选择 C# 语言
  • 然后点击Window Form App
  • 然后点击创建
  • 然后选择您的项目名称和位置并单击框架并确保您的框架是 4.0,然后单击创建。
  • 然后点击创建