zoukankan      html  css  js  c++  java
  • 父窗体包含两个子窗体

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    
    namespace WindowsFormsApplication18
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
            public void showform(Form f)
            {
    
                int count = 0;
                foreach (Form ff in this.MdiChildren)
                {
                    if (f.Name == ff.Name)
                    {
                        ff.Focus();
                        count++;
                    }
                }
                if(count==0)
                {
                    f.MdiParent = this;
                    f.Show();
                }
            
            }
    
            private void 窗体一ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                Form4 f = new Form4();
                showform(f);
              
            }
    
            private void 窗体二ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                Form5 f = new Form5();
                showform(f);
            }
        }
    }
  • 相关阅读:
    Merge Two Sorted Lists
    4Sum
    Letter Combinations of a Phone Number
    3Sum Closest
    3Sum
    Longest Common Prefix
    Roman to Integer
    Integer to Roman
    Container With Most Water
    Regular Expression Matching
  • 原文地址:https://www.cnblogs.com/yuyingming/p/5114450.html
Copyright © 2011-2022 走看看