コード例 #1
0
        private IUGConceptor CreateNewConcepteur(string text)
        {
            IUGConceptor concepteurr = new IUGConceptor();

            concepteurr.Text = text;
            return(concepteurr);
        }
コード例 #2
0
        private IUGConceptor CreateNewConcepteur()
        {
            IUGConceptor Concepteurr = new IUGConceptor();

            int    count = 1;
            string text  = $"IUG{count}";


            Concepteurr.Text = text;
            Concepteurr.Font = new Font("Microsoft Sans Serif", 7);
            // Concepteurr. = new Font("Microsoft Sans Serif", 7);
            return(Concepteurr);
        }
コード例 #3
0
        private void _tv_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (_tv.SelectedNode is null)
            {
                return;
            }
            var selNode = _tv.SelectedNode;

            if (selNode.Text.EndsWith("cpc") || selNode.Text.EndsWith("CPC"))
            {
                if (FindDocument(_tv.SelectedNode.Text) == null)
                {
                    string pathDir = Conversions.ToString(selNode.Tag);
                    var    fi      = new FileInfo(pathDir);

                    // edit file

                    {
                        string fullName = fi.FullName;
                        string fileName = Path.GetFileName(fullName);



                        Doc dummyDoc = new Doc();
                        dummyDoc.Text = fileName;
                        dummyDoc.metroComboBox1.Text = "CC+";
                        if (Home.dockPanel.DocumentStyle == DocumentStyle.SystemMdi)
                        {
                            dummyDoc.MdiParent = this;
                            dummyDoc.filepath  = fullName;
                            dummyDoc.Show();
                        }
                        else
                        {
                            dummyDoc.filepath = fullName;
                        }
                        dummyDoc.Show(Home.dockPanel);
                        try
                        {
                            dummyDoc.FileName = fullName;
                            dummyDoc.filepath = fullName;
                        }
                        catch (Exception exception)
                        {
                            dummyDoc.Close();
                            MessageBox.Show(exception.Message);
                        }
                    }
                }
            }
            if (selNode.Text.EndsWith("txt") || selNode.Text.EndsWith("TXT"))
            {
                if (FindDocument(_tv.SelectedNode.Text) == null)
                {
                    string pathDir = Conversions.ToString(selNode.Tag);
                    var    fi      = new FileInfo(pathDir);

                    // edit file

                    {
                        string fullName = fi.FullName;
                        string fileName = Path.GetFileName(fullName);



                        Doc dummyDoc = new Doc();
                        dummyDoc.Text = fileName;
                        dummyDoc.metroComboBox1.Text = "Text";
                        if (Home.dockPanel.DocumentStyle == DocumentStyle.SystemMdi)
                        {
                            dummyDoc.MdiParent = this;
                            dummyDoc.filepath  = fullName;
                            dummyDoc.Show();
                        }
                        else
                        {
                            dummyDoc.filepath = fullName;
                        }
                        dummyDoc.Show(Home.dockPanel);
                        try
                        {
                            dummyDoc.FileName = fullName;
                            dummyDoc.filepath = fullName;
                        }
                        catch (Exception exception)
                        {
                            dummyDoc.Close();
                            MessageBox.Show(exception.Message);
                        }
                    }
                }
            }


            if (selNode.Text.EndsWith("osm") || selNode.Text.EndsWith("OSM"))
            {
                if (FindDocument(_tv.SelectedNode.Text + " [Design]") == null)
                {
                    string pathDir = Conversions.ToString(selNode.Tag);
                    var    fi      = new FileInfo(pathDir);



                    //   Home.fileName = fi.FullName;
                    IUGConceptor concepteur = new IUGConceptor();

                    string nomfichier = fi.Name;
                    string text       = fi.Name;

                    concepteur.Text = nomfichier + " [Design]";
                    concepteur.Font = new Font("Microsoft Sans Serif", 7);

                    if (Home.dockPanel.DocumentStyle == DocumentStyle.SystemMdi)
                    {
                        concepteur.MdiParent = this;
                        concepteur.Show();
                        concepteur.Open_Host(fi.FullName);
                    }
                    else
                    {
                        concepteur.Show(Home.dockPanel);
                        concepteur.Open_Host(fi.FullName);
                        concepteur.metroFichierXml.Text = fi.FullName;
                    }
                }
            }

            if (selNode.Text.EndsWith("png") || selNode.Text.EndsWith("PNG") || selNode.Text.EndsWith("jpg") || selNode.Text.EndsWith("JPG") || selNode.Text.EndsWith("JPEG") || selNode.Text.EndsWith("BMP") || selNode.Text.EndsWith("bmp"))
            {
                string pathDir = Conversions.ToString(selNode.Tag);
                var    fi      = new FileInfo(pathDir);

                // edit file

                {
                    string fullName = fi.FullName;
                    string fileName = Path.GetFileName(fullName);



                    IMGViewer IMGDoc = new IMGViewer();
                    IMGDoc.Text = fileName;
                    if (Home.dockPanel.DocumentStyle == DocumentStyle.SystemMdi)
                    {
                        IMGDoc.MdiParent = this;

                        //IMGDoc.file = fullName;
                        //Load the image
                        IMGDoc.pictureBox1.Load(fullName);
                        Image img = IMGDoc.pictureBox1.Image;
                        //Adjust the image size after loading it to Picture box
                        if (IMGDoc.pictureBox1.Width < img.Width && IMGDoc.pictureBox1.Height < img.Height)
                        {
                            IMGDoc.pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
                        }
                        else
                        {
                            IMGDoc.pictureBox1.SizeMode = PictureBoxSizeMode.Normal;
                        }

                        IMGDoc.Show();
                    }
                    else
                    {
                        //dummyDoc.filepath = fullName;
                        IMGDoc.pictureBox1.Load(fullName);
                    }
                    Image img2 = IMGDoc.pictureBox1.Image;
                    //Adjust the image size after loading it to Picture box
                    if (IMGDoc.pictureBox1.Width < img2.Width && IMGDoc.pictureBox1.Height < img2.Height)
                    {
                        IMGDoc.pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
                    }
                    else
                    {
                        IMGDoc.pictureBox1.SizeMode = PictureBoxSizeMode.Normal;
                    }
                    IMGDoc.Show(Home.dockPanel);
                    try
                    {
                        //IMGDoc.FileName = fullName;
                        // Doc.filepath = fullName;
                    }
                    catch (Exception exception)
                    {
                        IMGDoc.Close();
                        MessageBox.Show(exception.Message);
                    }
                }
            }
        }
コード例 #4
0
        // Affichage du contexteMenu
        // Affiche la commande supprimer
        public override void ShowContextMenu(System.ComponentModel.Design.CommandID menuID, int x, int y)
        {
            // Création du contextMenu
            ContextMenuStrip  contextMenu      = new ContextMenuStrip();
            ToolStripMenuItem contextMenuitems = new ToolStripMenuItem();

            contextMenu.Items.AddRange(new ToolStripMenuItem[] { contextMenuitems });

            System.ComponentModel.Design.MenuCommand command;

            // Ajout de la commande
            command = menuCommandService.FindCommand(System.ComponentModel.Design.StandardCommands.Undo);
            if (command != null)
            {
                ToolStripDropDownButton menuItem;
                { menuItem = new ToolStripDropDownButton("Annuler", My.Resources.Resources.class_libraries, new EventHandler(OnMenuClicked)); }
                menuItem.Tag = command;
                contextMenu.Items.Add(menuItem);
            }

            // Ajout de la commande
            command = menuCommandService.FindCommand(System.ComponentModel.Design.StandardCommands.Redo);
            if (command != null)
            {
                ToolStripDropDownButton menuItem;
                { menuItem = new ToolStripDropDownButton("Rétablir", My.Resources.Resources.class_libraries, new EventHandler(OnMenuClicked)); }
                menuItem.Tag = command;
                contextMenu.Items.Add(menuItem);
            }

            contextMenu.Items.Add(new ToolStripSeparator());

            // Ajout de la commande
            command = menuCommandService.FindCommand(System.ComponentModel.Design.StandardCommands.Cut);
            if (command != null)
            {
                ToolStripDropDownButton menuItem;
                { menuItem = new ToolStripDropDownButton("Couper", My.Resources.Resources.class_libraries, new EventHandler(OnMenuClicked)); }
                menuItem.Tag = command;
                contextMenu.Items.Add(menuItem);
            }

            // Ajout de la commande
            command = menuCommandService.FindCommand(System.ComponentModel.Design.StandardCommands.Copy);
            if (command != null)
            {
                ToolStripDropDownButton menuItem;
                { menuItem = new ToolStripDropDownButton("Copier", My.Resources.Resources.class_libraries, new EventHandler(OnMenuClicked)); }
                menuItem.Tag = command;
                contextMenu.Items.Add(menuItem);
            }

            // Ajout de la command
            command = menuCommandService.FindCommand(System.ComponentModel.Design.StandardCommands.Paste);
            if (command != null)
            {
                ToolStripDropDownButton menuItem;
                { menuItem = new ToolStripDropDownButton("Coller", My.Resources.Resources.class_libraries, new EventHandler(OnMenuClicked)); }
                menuItem.Tag = command;
                contextMenu.Items.Add(menuItem);
            }

            // Ajout de la commande
            command = menuCommandService.FindCommand(System.ComponentModel.Design.StandardCommands.Delete);
            if (command != null)
            {
                ToolStripDropDownButton menuItem;
                { menuItem = new ToolStripDropDownButton("Supprimer", My.Resources.Resources.class_libraries, new EventHandler(OnMenuClicked)); }
                menuItem.Tag = command;
                contextMenu.Items.Add(menuItem);
            }

            contextMenuitems.DropDownItems.Add(new ToolStripSeparator());

            //// Ajout de la commande
            //if (Designer != null)
            //{
            //    VelerSoftware.Design.Toolkit.KryptonContextMenuItem Select_menuItem;
            //    VelerSoftware.Design.Toolkit.KryptonContextMenuItems Selects_menuItem = new VelerSoftware.Design.Toolkit.KryptonContextMenuItems();
            //    if (Variables.Langue == "fr") { Select_menuItem = new VelerSoftware.Design.Toolkit.KryptonContextMenuItem(Resources.SelectionnerTexte, null, null); } else { Select_menuItem = new VelerSoftware.Design.Toolkit.KryptonContextMenuItem(Resources.SelectionnerTexte_EN, null, null); }
            //    foreach (System.ComponentModel.Component item in Designer.ComponentContainer.Components)
            //    {
            //        VelerSoftware.Design.Toolkit.KryptonContextMenuItem Component_menuItem;
            //        Component_menuItem = new VelerSoftware.Design.Toolkit.KryptonContextMenuItem(item.Site.Name, new EventHandler(OnSelectComponentEvent2));
            //        Component_menuItem.Tag = item;
            //        Selects_menuItem.Items.Add(Component_menuItem);
            //    }
            //    Select_menuItem.Items.Add(Selects_menuItem);
            //    contextMenuitems.Items.Add(Select_menuItem);
            //}

            // Ajout de la command
            command = menuCommandService.FindCommand(System.ComponentModel.Design.StandardCommands.SelectAll);
            if (command != null)
            {
                ToolStripDropDownButton menuItem;
                { menuItem = new ToolStripDropDownButton("Sélectionner tout", My.Resources.Resources.class_libraries, new EventHandler(OnMenuClicked)); }
                menuItem.Tag = command;
                contextMenu.Items.Add(menuItem);
            }

            contextMenuitems.DropDownItems.Add(new ToolStripSeparator());

            // Ajout de la commande
            command = menuCommandService.FindCommand(System.ComponentModel.Design.StandardCommands.BringToFront);
            if (command != null)
            {
                ToolStripDropDownButton menuItem;
                { menuItem = new ToolStripDropDownButton("Mettre en avant", My.Resources.Resources.class_libraries, new EventHandler(OnMenuClicked)); }
                menuItem.Tag = command;
                contextMenu.Items.Add(menuItem);
            }

            // Ajout de la commande
            command = menuCommandService.FindCommand(System.ComponentModel.Design.StandardCommands.SendToBack);
            if (command != null)
            {
                ToolStripDropDownButton menuItem;
                { menuItem = new ToolStripDropDownButton("Send to back", My.Resources.Resources.class_libraries, new EventHandler(OnMenuClicked)); }
                menuItem.Tag = command;
                contextMenu.Items.Add(menuItem);
            }

            contextMenuitems.DropDownItems.Add(new ToolStripSeparator());

            // Ajout de la commande
            command = menuCommandService.FindCommand(System.ComponentModel.Design.StandardCommands.LockControls);
            if (command != null)
            {
                ToolStripDropDownButton menuItem;
                { menuItem = new ToolStripDropDownButton("Lock", My.Resources.Resources.class_libraries, new EventHandler(OnMenuClicked)); }
                menuItem.Tag = command;
                contextMenu.Items.Add(menuItem);
            }

            contextMenuitems.DropDownItems.Add(new ToolStripSeparator());

            // Ajout de la commande
            command = menuCommandService.FindCommand(System.ComponentModel.Design.StandardCommands.ViewCode);
            if (command != null)
            {
                ToolStripDropDownButton menuItem;
                { menuItem = new ToolStripDropDownButton("Voir le code", My.Resources.Resources.class_libraries, new EventHandler(OnMenuClicked)); }
                menuItem.Tag = command;
                contextMenu.Items.Add(menuItem);
            }

            // Ajout de la commande
            command = menuCommandService.FindCommand(System.ComponentModel.Design.StandardCommands.DocumentOutline);
            if (command != null)
            {
                ToolStripDropDownButton menuItem;
                { menuItem = new ToolStripDropDownButton("Créer un évènement", My.Resources.Resources.class_libraries, new EventHandler(OnMenuClicked)); }
                menuItem.Tag = command;
                contextMenu.Items.Add(menuItem);
            }

            // Ajout de la commande
            command = menuCommandService.FindCommand(System.ComponentModel.Design.StandardCommands.Properties);
            if (command != null)
            {
                ToolStripDropDownButton menuItem;
                { menuItem = new ToolStripDropDownButton("Propriétés", My.Resources.Resources.class_libraries, new EventHandler(OnMenuClicked)); }
                menuItem.Tag = command;
                contextMenu.Items.Add(menuItem);
            }

            // Affichage du contextMenu


            // erreur sur Designer.View : conversion impossible de 'object' en system.windows.form.control
            IUGConceptor _editeur = new IUGConceptor();

            _editeur.metroContextMenu1.Show(IUGConceptor.HostC, new Point(System.Windows.Forms.Control.MousePosition.X, System.Windows.Forms.Control.MousePosition.Y));
        }