父窗体内函数:
/// <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)
{
//添加代码
}
}
}
父窗体、子窗体关系设置
时间: 2024-10-09 16:18:10