私はC#でGUIプロジェクトを持っています。メインウィンドウクラスの定義は次のようになります。ビジュアルスタジオデザイナーのビューが正しいフォームを取得できません
FormView.csがFormViewInit.csがFormViewEventHandlers.cs質問が
using System;
using System.IO;
using System.Windows.Forms;
namespace RssReader
{
partial class FormView
{
private void Quit_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Do you really want to quit?", "Exit", MessageBoxButtons.YesNo)
== DialogResult.Yes)
Application.Exit();
}
// here goes event handler functions
}
}
されたファイル
namespace RssReader
{
partial class FormView
{
private void InitializeComponent()
{
this.MainContainer = new System.Windows.Forms.SplitContainer();
this.Items = new System.Windows.Forms.TreeView();
this.Message = new System.Windows.Forms.WebBrowser();
this.MainMenu = new System.Windows.Forms.MenuStrip();
this.File = new System.Windows.Forms.ToolStripMenuItem();
this.AddFeed = new System.Windows.Forms.ToolStripMenuItem();
this.Separator = new System.Windows.Forms.ToolStripSeparator();
this.Quit = new System.Windows.Forms.ToolStripMenuItem();
// the only component in this file is InitializeComponent method
// all, what it does is just defining items on the form
// and initializing it, i.e., creating instances, assign names etc.
}
}
}
ファイル
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace RssReader
{
partial class FormView : Form, IView
{
private SplitContainer MainContainer;
private TreeView Items;
private MenuStrip MainMenu;
private ToolStripMenuItem File;
private ToolStripMenuItem AddFeed;
private ToolStripSeparator Separator;
private ToolStripMenuItem Quit;
private WebBrowser Message;
/* some methods here which are implementing some kind of logic */
}
}
ファイルなぜFormViewを表示しようとしているのですか?ビジュアルスタジオ2010のデザインビューでcs?
私は強く、その後何に少しずつそれを変更し、あなたが「正常な」フォームからスタート示唆しますあなたはデザイナーを壊したかどうか毎回チェックする必要があります。 –
あなたのInitializeComponetクラスがあなたのフォームとその子コントロールの適切な値を適切に設定していないように聞こえます(あなたのフォームに要素を追加するコードがないように思えます)。デザイナーは、あなたのために多くのこの作業を行うことができます。 –
コードは、フォームの正しい値を設定し、その子が正しく設定されています。私は、アプリケーションを実行することができ、期待どおりに動作します。唯一のことはデザイナーの視点でアプリケーションを見ることができないことです。 – cheshie