MenuStrip不允许创建菜单

4
我正在使用Visual Studio 2019,并创建了一个Windows窗体应用程序项目。在窗体中,当我拖放MenuStrip时,它没有显示“在此处输入类型以创建菜单”的框。我在互联网上搜索,但没有找到任何解决方案。有人可以帮助我吗?提前感谢。

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;
    }
}

看起来很好。顺便说一句,我不熟悉新的WinForms设计师。但我建议在问题中添加“winforms”标签。 - aepot
抱歉,我不知道你在问什么,因为我是这个领域的新手。 - Ahmad Muhammad
@AhmadMuhammad:展开“属性”窗口(右下角)。现在您将看到一个“下拉列表”属性,您可以单击并创建项目。 - Poul Bak
看起来你遇到的问题是因为你创建了一个.Net Core应用程序。从你的评论中可以看出...“我在网上搜索了但是没有找到任何解决方案。”...这是因为“大多数”解决方案将使用.Net Framework而不是.Net Core。除非你特别需要使用.Net Core,否则建议你创建一个.Net Framework应用程序,然后你搜索到的大多数解决方案也将使用.Net Framework。不清楚是否必须使用.Net Core,如果必须,则添加.Net Core规范来优化你的搜索。 - JohnG
2
.NETCore的WinForms设计器不完整。这是一个大项目。在完成之前,建议使用“.NET Framework”项目模板。 - Hans Passant
显示剩余5条评论
5个回答

3

确保在创建项目时选择“Windows Forms 应用程序(.Net Framework)”,然后你将看到“Type here”。


1
与 Microsoft Visual Studio Community 2019 版本 16.8.4 相关,界面未显示预期的占位符。 - Prem Singh Bist

1
我想到了解决方法,创建表单时不要使用core,而是使用.net框架。

1

0

这个问题通常出现在最新版本的Visual Basic Studio中,例如Visual Studio Community Edition 2019。请按照以下步骤在VB 2019中执行。

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

-3
  • 点击新项目。
  • 然后点击所有语言
  • 然后选择C#语言
  • 然后点击窗体应用程序
  • 然后点击创建
  • 然后选择您的项目名称和位置,单击框架并确保您的框架为4.0,然后单击创建。
  • 然后点击创建

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接