WinFrom吧?
1:使用ShowDialog()代替你使用的Show()
2:如果不能使用模式的窗口,那每次点击的时候不要重新实例化窗体,而只是在第一次点击时实例化

解决方案 »

  1.   

    如果只是为了不多次创建,那设置一个bool型的flag就ok了,当false的时候创建,if true,则直接跳出click事件,当关闭了窗口时,重新将flage设置为false。
    如果是当已经创建,第二次点击时,使其active,那就用窗口的handler作为flage,if (null == handler),创建,else
    调用Win32,API,将这个handler作为其中一个参数传入,可以达到激活,并且置顶的功能。如果关闭窗口,handler设置为null
      

  2.   

    #region 查询一个子窗体是否存在
            private bool checkChildFrmExist(string childFrmName)
            {
                foreach (Form childFrm in this.MdiChildren)
                {
                    //用子窗体的Name进行判断,如果已经存在则将他激活
                    if (childFrm.Name == childFrmName)
                    {
                        if (childFrm.WindowState == FormWindowState.Minimized)
                            childFrm.WindowState = FormWindowState.Normal;
                        childFrm.Activate();
                        return true;
                    }
                }
                return false;
            }
            #endregion
    用这个方法就可以了!
      

  3.   

    我用的是C#,我加过showdialog()可是还是不行
      

  4.   

    showdialog()有个缺陷,你必须首先相应它,如果这样对你没有影响,那用showdialog();
    如果你要的不是这样,就设置一个flag好了,简单,快速。
      

  5.   

    没得说,ShowDialog()
    实在不想用ShowDialog的话就设置当点击了那个弹出窗口的按钮之后把他设为不可用  Enable=false
      

  6.   

    把new拖到    button事件外边  绝对管用
      

  7.   

    我试了,showdialog();它就显示“非顶级窗体不能显示为模式对话框。在调用 showDialog 之前应从所有父窗体中移除该窗体。”
      

  8.   

    Demo
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;namespace Demo_Project
    {
    public class Form1 : System.Windows.Forms.Form
    {
    private System.Windows.Forms.Button button1;
    private Form m_SubForm;
    private System.ComponentModel.Container components = null; public Form1()
    {
    InitializeComponent();
    } protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if (components != null) 
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } private void InitializeComponent()
    {
    this.button1 = new System.Windows.Forms.Button();
    this.SuspendLayout(); this.button1.Location = new System.Drawing.Point(111, 60);
    this.button1.Name = "button1";
    this.button1.TabIndex = 0;
    this.button1.Text = "Open";
    this.button1.Click += new System.EventHandler(this.button1_Click); this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
    this.ClientSize = new System.Drawing.Size(292, 266);
    this.Controls.Add(this.button1);
    this.Name = "Form1";
    this.Text = "Form1";
    this.ResumeLayout(false); } [STAThread]
    static void Main() 
    {
    Application.Run(new Form1());
    } private void button1_Click(object sender, System.EventArgs e)
    {
    if (m_SubForm == null)
    {
    m_SubForm = new Form();
    m_SubForm.Closed +=new EventHandler(m_SubForm_Closed); m_SubForm.Show();
    }
    else
    {
    m_SubForm.Activate();
    }
    } private void m_SubForm_Closed(object sender, EventArgs e)
    {
    (sender as Form).Closed -= new EventHandler(m_SubForm_Closed); m_SubForm = null;
    }
    }
    }
      

  9.   

    没有啊,好像有种模示的。辛苦你们了,都不灵,我先创了一个登录框,登录后跳到主页面。主页面上有几个按钮点击分别可以弹出窗体,点多少次就有多少个。唉。也不知道怎么搞。不过还是谢谢你们。主页面是MDI容器。还有就是在上面的按钮竟然在弱出来的窗体的上面
      

  10.   

                 private void button1_Click(object sender, EventArgs e)
                 {
                  Form frmList = Application.OpenForms["Form1"];   //FOrm1为子窗体的Name
                  if (frmList != null)
                  {
                    frmList.Text += "\\abcde";
                    frimlist.Activate();
                  }
                  }试一下,不知道能否帮上忙啊
      

  11.   

    应该是这样就可以了:  
    From1 Fr1 = new From1();
        Fr1.ShowDialog(this);
      

  12.   

    请参见MDI窗体只打开一个相关问题!
      

  13.   

    showdialog可以锁住主窗体,直到弹出的窗体退出