我有一个父表单和一个对话框。我需要将信息从父级传递到对话框
这是我所拥有的:
private void Item_Click(object sender, EventArgs e)
{
DialogResult result = DialogResult.OK;
DlgGraphOptions _frmDlgGraphOptions = new DlgGraphOptions();
_frmDlgGraphOptions.m_SerOpts = theDGroup.m_SerOpts;
_frmDlgGraphOptions.ShowDialog(this);
if (result == DialogResult.OK)
{
// Save the revised options to the Data Group
theDGroup.m_SerOpts = _frmDlgGraphOptions.m_SerOpts;
}
在 DlgGraphOptions(child/dialog) 表单中,我已经初始化
public partial class DlgGraphOptions : Form
{
public GraphOpts_t m_SerOpts = new GraphOpts_t();
}
private void InitSettings(int idxSeries)
{
m_nMaxPts = m_SerOpts.GetMaxPts(idxSeries);
}
所以我需要将 DGroup.m_SerOpts 从父级传递给对话框,所以我已经完成了
_frmDlgGraphOptions.m_SerOpts = theDGroup.m_SerOpts;
在父母。现在在孩子身上:
public GraphOpts_t m_SerOpts = new GraphOpts_t;
这似乎是错误的。我不想重新初始化它。