Ejemplo n.º 1
0
        private void toolStripMenuItem3_Click(object sender, EventArgs e)
        {
            newWindow           = new NewEditor();
            newWindow.Text     += $"{++id}";
            newWindow.MdiParent = this;
            newWindow.Show();


            if (id == 1)
            {
                fileToolStripMenuItem.DropDownItems.Add(new ToolStripSeparator());
            }

            ToolStripMenuItem newItem = new ToolStripMenuItem();

            newItem.Text = newWindow.Text;

            newItem.Click += (o, s) =>
            {
                newWindow.Focus();
                if (newWindow.WindowState == FormWindowState.Minimized)
                {
                    newWindow.WindowState = FormWindowState.Normal;
                }
            };

            fileToolStripMenuItem.DropDownItems.Add(newItem);
            newItem.Checked      = true;
            toolStripLabel1.Text = newWindow.Text;
        }
Ejemplo n.º 2
0
        private void TextEdit_MdiChildActivate(object sender, EventArgs e)
        {
            if (this.MdiChildren.Length == 0)
            {
                return;
            }

            newWindow = (NewEditor)this.ActiveMdiChild;

            if (newWindow == null)
            {
                toolStripLabel1.Text = "";
                id = 0;
                return;
            }



            //cbSize.Text = newWindow.FontSize.ToString();
            //cbFont.Text = newWindow.TextBox.Font.Name;
            //cd.Color = newWindow.TextBox.ForeColor;

            foreach (ToolStripItem item in fileToolStripMenuItem.DropDownItems)
            {
                if (item is ToolStripMenuItem)
                {
                    if (item.Text.Contains(newWindow.Text))
                    {
                        (item as ToolStripMenuItem).Checked = true;
                    }
                    else
                    {
                        (item as ToolStripMenuItem).Checked = false;
                    }
                }
            }
            toolStripLabel1.Text = newWindow.Text;
        }