zoukankan      html  css  js  c++  java
  • MDI 窗体

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

    namespace _7._1练习
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }

    private void 销售模块ToolStripMenuItem_Click(object sender, EventArgs e)
    {
    bool has = false;
    Form2 f2 = new Form2();

    foreach (Form f in panel1.Controls)
    {
    if (f.Name == f2.Name)//窗口只打开一次
    {
    has = true;
    f.Show();
    f2.Close();
    }
    }
    if (has)
    {
    foreach (Form f in panel1.Controls)
    {
    if (f.Name != f2.Name)
    {
    f.Hide();//相同命名自动隐藏
    }
    }
    }
    else
    {
    f2.WindowState = FormWindowState.Maximized;//窗口最大化
    f2.MdiParent = this;//mdi 父集是form1
    f2.Parent = panel1;// 父集是form1 里的 panel1
    f2.Show();
    }
    }

    private void 仓库模块ToolStripMenuItem_Click(object sender, EventArgs e)
    {
    bool has = false;
    Form f3 = new Form3();

    foreach (Form f in panel1.Controls)
    {
    if (f.Name == f3.Name)////窗口只打开一次
    {
    has = true;
    f.Show();
    f3.Close();
    }
    }
    if (has)
    {
    foreach (Form f in panel1.Controls)
    {
    if (f.Name != f3.Name)
    {
    f.Hide();////相同命名自动隐藏
    }
    }
    }
    else
    {
    f3.WindowState = FormWindowState.Maximized;////窗口最大化
    f3.MdiParent = this;//mdi 父集是form1
    f3.Parent = panel1;// 父集是form1 里的 panel1
    f3.Show();
    }
    }

    private void panel1_Paint(object sender, PaintEventArgs e)
    {

    }
    }
    }

  • 相关阅读:
    安装mysql
    date, Calendar
    心态
    jdbc ---- DBUTilDao 类
    jdbc--------JdbcUtilDao 类
    Python与C/C++相互调用
    用链表和数组实现HASH表,几种碰撞冲突解决方法
    用链表实现消息队列
    文件系统的发展
    [深度学习]开源的深度学习框架
  • 原文地址:https://www.cnblogs.com/suiyuejinghao123/p/5636324.html
Copyright © 2011-2022 走看看