これは私のMDI親です。C# - アプリケーションからMDI親を取得する可能性がありますか?
public partial class frmMain : Form
{
public Options options {get; set;}
public Project project {get; set;}
public frmMain()
{
InitializeComponent();
}
}
以下のMy MDIの子は、プロジェクトとオプションにアクセスする必要があります。
public partial class frmInput : form
{
public frmInput(frmMain parent)
{
InitializeComponent();
this.MdiParent = parent;
//Of course I can do this
Options options = ((frmMain) this.MdiParent).options;
//But if I can have something as following, I can have
//a static method to access options in the frmMain anywhere.
frmMain mainform = Application.MainForm;
Options options = mainform.options;
}
}
アプリケーションがMdiParentへのアクセスを提供しない場合は、他の方法で静的メソッドでアクセスできますか?
ありがとうございます – kemdo