关于自定义模式对话框的奇怪问题???(100分)

  • 主题发起人 wisewang
  • 开始时间
W

wisewang

Unregistered / Unconfirmed
GUEST, unregistred user!
//选项按钮
private void button3_Click(object sender, System.EventArgs e)
{
using(Form2 SetupWindow = new Form2())
{
SetupWindow.comboBox1.SelectedIndex = this.SetupStatus.CardBack - 1;
SetupWindow.textBox1.Text = this.SetupStatus.TitleText;
if (SetupWindow.ShowDialog(this) == DialogResult.OK)
{
this.SetupStatus.CardBack = SetupWindow.comboBox1.SelectedIndex +
1;
this.SetupStatus.TitleText = SetupWindow.textBox1.Text;
}
}
}
Form2为自定义的类,用于设置系统参数的对话框;
SetupStatus为自定义的类,用于设置系统的默认值。
现问题为:当选项窗口关闭时主窗口隐藏于其他窗口之下(即焦点移至其他程序上),如
果修改代码如下时:

//选项按钮
private void button3_Click(object sender, System.EventArgs e)
{
SetupWindow.comboBox1.SelectedIndex = this.SetupStatus.CardBack - 1;
SetupWindow.textBox1.Text = this.SetupStatus.TitleText;
if (SetupWindow.ShowDialog(this) == DialogResult.OK)
{
this.SetupStatus.CardBack = SetupWindow.comboBox1.SelectedIndex +
1;
this.SetupStatus.TitleText = SetupWindow.textBox1.Text;
}
}
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
#region 自定义的初始化代码
Form2 SetupWindow = new Form2();
#endregion
}
此时关闭选项窗口时主窗口正常显示。
我想动态创建选项窗口,但不知如何设置才能在选项窗口关闭后主窗口显示正常。
代码:
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
顶部