在窗口中打开子窗口

 

子窗口

private void btn_OK_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }

        private void btn_Cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

父窗口

 

  Form4 f4 = new Form4();
                //f4.Location =
                Point point = this.Location;
                point.X += 220;
                point.Y -=330;
                f4.Location = point;//设定弹窗位置哟

                if (f4.ShowDialog(this) == DialogResult.OK)
                {}

 

 

 

show()方法,只是显示出来

showdialog(),是模态效果

posted @ 2012-05-16 11:46  咸鱼公子  Views(227)  Comments(0Edit  收藏  举报