| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 758 人关注过本帖
标题:[求助]第38个小程序
只看楼主 加入收藏
天气预报不准
Rank: 1
等 级:新手上路
帖 子:200
专家分:0
注 册:2006-3-16
收藏
 问题点数:0 回复次数:4 
[求助]第38个小程序

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace WindowsApplication7
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{ private int Count=0;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.MenuItem New;
private System.Windows.Forms.MenuItem Active;
private System.Windows.Forms.MenuItem Exit;
private System.Windows.Forms.MenuItem Cascade;
private System.Windows.Forms.MenuItem Horizontal;
private System.Windows.Forms.MenuItem Vertical;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();

//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}

/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.New = new System.Windows.Forms.MenuItem();
this.Active = new System.Windows.Forms.MenuItem();
this.Exit = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.Cascade = new System.Windows.Forms.MenuItem();
this.Horizontal = new System.Windows.Forms.MenuItem();
this.Vertical = new System.Windows.Forms.MenuItem();
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem5});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.New,
this.Active,
this.Exit});
this.menuItem1.Text = "File";
//
// New
//
this.New.Index = 0;
this.New.Text = "New";
this.New.Click += new System.EventHandler(this.New_Click);
//
// Active
//
this.Active.Index = 1;
this.Active.Shortcut = System.Windows.Forms.Shortcut.AltF9;
this.Active.Text = "Active Child";
this.Active.Visible = false;
this.Active.Click += new System.EventHandler(this.Active_Click);
//
// Exit
//
this.Exit.Index = 2;
this.Exit.Text = "Exit";
this.Exit.Click += new System.EventHandler(this.Exit_Click);
//
// menuItem5
//
this.menuItem5.Index = 1;
this.menuItem5.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.Cascade,
this.Horizontal,
this.Vertical});
this.menuItem5.Text = "Arrange";
//
// Cascade
//
this.Cascade.Index = 0;
this.Cascade.Text = "Cascade";
this.Cascade.Click += new System.EventHandler(this.Cascade_Click);
//
// Horizontal
//
this.Horizontal.Index = 1;
this.Horizontal.Text = "Horizontal";
this.Horizontal.Click += new System.EventHandler(this.Horizontal_Click);
//
// Vertical
//
this.Vertical.Index = 2;
this.Vertical.Text = "Vertical";
this.Vertical.Click += new System.EventHandler(this.Vertical_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Menu = this.mainMenu1;
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);

}
#endregion

/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

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

private void Active_Click(object sender, System.EventArgs e)
{
MessageBox.Show(this.ActiveMdiChild.Text,"Mdi FORM");
}

private void New_Click(object sender, System.EventArgs e)
{
Form frmchild = new Form();
frmchild.MdiParent=this;
frmchild.Show();
frmchild.Text="Child Form"+ Count.ToString();
Count++;
}

private void Horizontal_Click(object sender, System.EventArgs e)
{
this.LayoutMdi(MdiLayout.TileHorizontal);
}

private void Vertical_Click(object sender, System.EventArgs e)
{
this.LayoutMdi(MdiLayout.TileVertical);

}

private void Cascade_Click(object sender, System.EventArgs e)
{
this.LayoutMdi(MdiLayout.Cascade);

}

private void Form1_Load(object sender, System.EventArgs e)
{

}


}
}
怎么老是说未添加异常什么的??????
帮忙看看,感激不尽!

[此贴子已经被作者于2006-4-19 15:42:47编辑过]

搜索更多相关主题的帖子: System using Forms private 
2006-04-19 15:24
十一月天
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:10
帖 子:3030
专家分:0
注 册:2006-4-19
收藏
得分:0 
private void Form1_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{}
}
加上这个试试

当头晕的时候我终于明白了什么叫爱情。
2006-04-19 15:35
天气预报不准
Rank: 1
等 级:新手上路
帖 子:200
专家分:0
注 册:2006-3-16
收藏
得分:0 
报错:程序发生了未处理的异常。
被指定为此窗体的MdiParent的窗体不是MdiContainer 参数名:Value
程序能运行出界面来,但点击New后就报错了。

哎!发型有点乱。。。。。。
2006-04-19 15:37
天气预报不准
Rank: 1
等 级:新手上路
帖 子:200
专家分:0
注 册:2006-3-16
收藏
得分:0 
加了后程序编译时说:IsPostBack在什么里面不存在!
谢谢!

哎!发型有点乱。。。。。。
2006-04-19 15:41
十一月天
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:10
帖 子:3030
专家分:0
注 册:2006-4-19
收藏
得分:0 
你设置一下断点,看看是那里出的问题

当头晕的时候我终于明白了什么叫爱情。
2006-04-19 16:07
快速回复:[求助]第38个小程序
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.028567 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved