-1

昨夜、Visual Studio 2012 で C# のプロジェクトに取り組んでいました。突然、Visual Studio からいくつかのエラーが発生し、メニュー ストリップが非表示になりました。現在、フォームにメニューストリップがなく、視覚的なオプションがすべて失われていますが、formdesigner.csファイルにはすべてのコードがあります。すべてのオプションを再度作成することは難しく、時間がかかり、新しい名前でメニュー ストリップを作成し、すべてのサブ項目を新しい名前で作成する必要があるため、再度作成することはできません。

失われたメニュー ストリップを再開するにはどうすればよいですか?

これは私のデザイナーコードの一部です:

 this.Main = new System.Windows.Forms.ToolStripMenuItem();
 this.userOptionTtm = new System.Windows.Forms.ToolStripMenuItem();
 this.changePasswprdTSM = new System.Windows.Forms.ToolStripMenuItem();
 this.CalenderOption = new System.Windows.Forms.ToolStripMenuItem();
 this.CalenderOption2 = new System.Windows.Forms.ToolStripMenuItem();
 this.CalenderOption1 = new System.Windows.Forms.ToolStripMenuItem();
 this.hollydays = new System.Windows.Forms.ToolStripMenuItem();
 this.ExitTsm = new System.Windows.Forms.ToolStripMenuItem();
 this.useroption = new System.Windows.Forms.ToolStripMenuItem();
 this.ReportsTSM = new System.Windows.Forms.ToolStripMenuItem();
 this.loanListTsm = new System.Windows.Forms.ToolStripMenuItem();
 this.FeutureJobsTSM = new System.Windows.Forms.ToolStripMenuItem();

そして、以前に作成 (または定義) された menu のすべてのサブ項目のプロパティがあります。例えば ​​:

//
// Main
//
this.Main.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.userOptionTtm,
this.CalenderOption,
this.ExitTsm});
this.Main.Font = new System.Drawing.Font("Segoe UI", 9F);
this.Main.Name = "Main";
this.Main.Size = new System.Drawing.Size(62, 20);
this.Main.Text = "تنظیمات";
//
// userOptionTtm
//
this.userOptionTtm.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.changePasswprdTSM});
this.userOptionTtm.Font = new System.Drawing.Font("Segoe UI", 10F);
this.userOptionTtm.Image = global::TimeManagment.Properties.Resources._0079;
this.userOptionTtm.Name = "userOptionTtm";
this.userOptionTtm.Size = new System.Drawing.Size(165, 24);
this.userOptionTtm.Text = "تنظیمات کاربر";
this.userOptionTtm.Click += new System.EventHandler(this.chengePasswordTtm_Click_1);

私のフォームコードには、このメニューのすべてのコードがあります。例えば:

private void FeutureJobsTSM_Click(object sender, EventArgs e)
{
    FeutureReportForm.isJobs = true;
    FeutureReportForm fr = new FeutureReportForm();
    fr.ShowDialog(this);
}

また

private void changePasswprdTSM_Click(object sender, EventArgs e)
{
    chengePasswordForm cpf = new chengePasswordForm();
    cpf.ShowDialog();
}
4

1 に答える 1

0

皆さんthx。これらの行を Form.Designer.cs ファイルに追加すると、問題が修正されました。

this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.menuStrip1.BackColor = System.Drawing.Color.Transparent;
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] 
{ this.Main,this.ReportsTSM });
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.menuStrip1.Size = new System.Drawing.Size(589, 24);
this.menuStrip1.TabIndex = 10;
this.menuStrip1.Text = "menuStrip1";
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.Controls.Add(this.menuStrip1);     
private System.Windows.Forms.MenuStrip menuStrip1;
于 2013-10-27T14:59:48.423 に答える