Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3287373
  • 博文数量: 266
  • 博客积分: 3081
  • 博客等级: 中校
  • 技术积分: 2640
  • 用 户 组: 普通用户
  • 注册时间: 2005-07-04 10:35
个人简介

没什么好介绍的!穷屌丝一个~

文章分类

全部博文(266)

文章存档

2021年(3)

2020年(1)

2019年(2)

2016年(5)

2015年(1)

2014年(1)

2011年(9)

2010年(16)

2009年(31)

2008年(58)

2007年(111)

2006年(2)

2005年(26)

我的朋友

分类: C/C++

2011-01-05 11:07:24



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

namespace ppop_client
{
    public partial class MDI : Form
    {
        private int childFormNumber = 0;

        public MDI()
        {
            InitializeComponent();
        }

        private void ShowNewForm(object sender, EventArgs e)
        {
            // 创建此子窗体的一个新实例。

            Form childForm = new Form1();
            // 在显示该窗体前使其成为此 MDI 窗体的子窗体。

            childForm.MdiParent = this;
            childForm.Text = "窗口" + childFormNumber++;

            childForm.Show();
        }
//根据委托定义事件
public static event meEventHandler me1;
//按钮引发事件
        private void toolStripButton_test_Click(object sender, EventArgs e)
        {
            if (me1 != null)
                me1(0);
        }
    }
}



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

namespace ppop_client
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

             //注册事件到本类的onme1函数
                MDI.me1+=new meEventHandler(onme1);
        }
            //事件处理
        public void onme1(object o)
        {
            label1.Text = "heheh";
            
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        
    }
}


using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace ppop_client
{

//定义一个委托
    public delegate void meEventHandler(object o);


    static class Program
    {
        ///



        /// 应用程序的主入口点。

        ///


        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MDI());
        }
    }
}


阅读(1333) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~