我想在主窗体上添加一个按钮,点击这个按钮之后弹出一个没有边框的子对话框,让这个子对话框的左、右、下三边和主窗体的左、右、下边重合,子窗体的上边比主窗体的上边低20个像素,应该怎么实现呀,请高手指点下,自己摸索了会,没整出来。谢谢!

解决方案 »

  1.   


    Form fmDialog = new Form();
    fmDialog.StartPosition = FormStartPosition.Manual;
    fmDialog.FormBorderStyle = FormBorderStyle.None;
    fmDialog.Size = new Size(宽度,高度);//
    fmDialog.Location = new Point(x位置,y位置);
    fmDialog.ShowDialog();
    //主窗口的上下左右,为this.Top;this.Bottom;this.Left;this.Right;直接取来用就行
      

  2.   


      private void button1_Click(object sender, EventArgs e)
            {
                Form3 frm3 = new Form3();
                frm3.MdiParent = this;
                 
                frm3.Show();
                frm3.Width = this.Width;
                frm3.Left = 0;
                frm3.Top = 20;
               frm3.Height = this.Height-20;
               
            }给你个笨办法
      

  3.   

    Form1 fm= new Form1();
    frm.MdiParent=this;
    frm.Width=this.Width;
    frm.Height=this.Height;
    frm.Top=数值;
    frm.Show();
      

  4.   

    frm.WindowState = FormWindowState.Maximized
      

  5.   

    MDI子窗口Height=父窗口Height-20,Dock=DockStyle.Buttom
      

  6.   

                this.IsMdiContainer = true;
                this.Size = new Size(500, 500);            Form F = new Form();
                F.Height = this.ClientRectangle.Height - 20;
                F.MdiParent = this;
                F.Show();
                F.Dock = DockStyle.Bottom;