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)
    {

    }
    }
    }

  • 相关阅读:
    Metabase研究 开源的数据报表
    Redis配置不当致使root被提权漏洞
    一个程序员被骗去养猪
    调度器简介,以及Linux的调度策略
    Linux的内存分页管理
    在地铁11号线上写书
    为什么说“概率”带来一场现代革命?
    快速学习Bash
    用树莓派玩转蓝牙
    树莓派的GPIO编程
  • 原文地址:https://www.cnblogs.com/suiyuejinghao123/p/5636324.html
Copyright © 2011-2022 走看看