昨夜、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();
}