c#mdi主体窗加了控件,如何让它不挡住子窗体?

felix3118 2007-10-30 09:59:47
c#mdi主体窗加了控件,如何让它不挡住子窗体?
...全文
122 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
lalac 2007-10-30
  • 打赏
  • 举报
回复
不知道这样是不是你要的:
code=C#]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
public partial class MDIParent1 : Form
{
private int childFormNumber = 0;

public MDIParent1()
{
InitializeComponent();
}



private void ShowNewForm(object sender, EventArgs e)
{
// Create a new instance of the child form.
Form childForm = new Form();
// Make it a child of this MDI form before showing it.
childForm.MdiParent = this;
childForm.Text = "Window " + childFormNumber++;
childForm.Show();
}

/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.ToolTip = new System.Windows.Forms.ToolTip(this.components);
this.panel1 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.splitter1 = new System.Windows.Forms.Splitter();
this.button1 = new System.Windows.Forms.Button();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.button1);
this.panel1.Controls.Add(this.label1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(160, 418);
this.panel1.TabIndex = 4;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(28, 122);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(89, 24);
this.label1.TabIndex = 0;
this.label1.Text = "Put anything\r\nyou want here.";
//
// splitter1
//
this.splitter1.Location = new System.Drawing.Point(160, 0);
this.splitter1.Name = "splitter1";
this.splitter1.Size = new System.Drawing.Size(3, 418);
this.splitter1.TabIndex = 5;
this.splitter1.TabStop = false;
//
// button1
//
this.button1.Location = new System.Drawing.Point(30, 40);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1;
this.button1.Text = "New Form";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.ShowNewForm);
//
// MDIParent1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(632, 418);
this.Controls.Add(this.splitter1);
this.Controls.Add(this.panel1);
this.IsMdiContainer = true;
this.Name = "MDIParent1";
this.Text = "MDIParent1";
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);

}
#endregion

private ToolTip ToolTip;
private Panel panel1;
private Label label1;
private Splitter splitter1;
}
}

[/code]

110,537

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧