我建了个 MainForm , 在 MainForm 中放了个ListView 控件, 我希望在 ListView 的工作区点击鼠标的右键,能够弹出一个子窗口;目前这个已经实现,但是子窗口总是在 ListView 的背后,请高手指点, 谢谢

解决方案 »

  1.   

    你的MainForm的属性TOPMOST是否为TRUE呀?把它改为FALSE
      

  2.   

    private void menuItemDirAdd_Clicked(object sender, System.EventArgs e)
    {
      
        DirAdd  childForm;
     
        childForm = GetChildForm();
    this.ActivateMdiChild ( childForm );
                childForm.Show();
    childForm.Activate();
    childForm.BringToFront ();

    // CreateMyForm();
    }
      

  3.   

    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;namespace Ch18Ex02
    {
    /// <summary>
    /// DirAdd 的摘要说明。
    /// </summary>
    public class DirAdd : System.Windows.Forms.Form
    {
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.TextBox textBox1;
    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.Button button2;
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null; public DirAdd()
    {
    //
    // Windows 窗体设计器支持所必需的
    //
    InitializeComponent(); //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if(components != null)
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region Windows Form Designer generated code
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    this.label1 = new System.Windows.Forms.Label();
    this.textBox1 = new System.Windows.Forms.TextBox();
    this.button1 = new System.Windows.Forms.Button();
    this.button2 = new System.Windows.Forms.Button();
    this.SuspendLayout();
    // 
    // label1
    // 
    this.label1.Location = new System.Drawing.Point(32, 72);
    this.label1.Name = "label1";
    this.label1.TabIndex = 0;
    this.label1.Text = "label1";
    // 
    // textBox1
    // 
    this.textBox1.Location = new System.Drawing.Point(160, 72);
    this.textBox1.Name = "textBox1";
    this.textBox1.TabIndex = 1;
    this.textBox1.Text = "textBox1";
    // 
    // button1
    // 
    this.button1.Location = new System.Drawing.Point(32, 176);
    this.button1.Name = "button1";
    this.button1.TabIndex = 2;
    this.button1.Text = "button1";
    // 
    // button2
    // 
    this.button2.Location = new System.Drawing.Point(184, 184);
    this.button2.Name = "button2";
    this.button2.TabIndex = 3;
    this.button2.Text = "button2";
    // 
    // DirAdd
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
    this.ClientSize = new System.Drawing.Size(292, 273);
    this.ControlBox = false;
    this.Controls.AddRange(new System.Windows.Forms.Control[] {
      this.button2,
      this.button1,
      this.textBox1,
      this.label1});
    this.ForeColor = System.Drawing.Color.Cornsilk;
    this.Location = new System.Drawing.Point(120, 120);
    this.Name = "DirAdd";
    this.Text = "DirAdd";
    this.Load += new System.EventHandler(this.DirAdd_Load);
    this.ResumeLayout(false); }
    #endregion private void DirAdd_Load(object sender, System.EventArgs e)
    {

    }
    }
    }
      

  4.   

    生成新FORM的時候固定新FORM的位置啊
      

  5.   

    childForm.Show();
    这一句改成childForm.ShowDialog();
      

  6.   

    你是mdi,在主窗体客户区的控件是覆盖在子窗体上面的,你的弹出窗体不要设mdi子窗体,用
    Showdialog方式打开就可以了
      

  7.   

    ChildForm.ShowDialog();
    ChildForm.MdiParent=this;
      

  8.   

    //使用模式方式打开
    ChildForm.ShowDialog(this);
      

  9.   

    childForm.Show();
    改成
    childForm.ShowDialog();
    就可以了
      

  10.   

    private void menuItemDirAdd_Clicked(object sender, System.EventArgs e)
    {
      
        DirAdd  childForm=new DirAdd();
                          childForm.Show();
    }