父窗体内函数:
/// <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)
{
//添加代码
}
}
}