父窗体内函数:
/// <summary>
/// 电台频率框获取焦点后 弹出数字窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void txtFrequency_Enter(object sender, EventArgs e)
{
DigitDialog fsDigit = new DigitDialog();
this.AddOwnedForm(fsDigit);//添加这句
fsDigit.Show();
}
子窗体内函数:
private void btnNum0_Click(object sender, EventArgs e)
{
Button btnNumber = sender as Button;
Form fParent = (Form)this.Owner;//获取父窗口
if (null != fParent)
{
foreach (Control crtl in fParent.Controls)
{
//添加代码
}
}
}
本文出自 “交流思想 你我共赢” 博客,请务必保留此出处http://xfqxj.blog.51cto.com/2342497/1430783