Exemple #1
0
        protected PipeOnCanvas(ControlOnCanvasSer ser)
            : base(ser)
        {
            MainWindow mainWindow = (MainWindow)Application.Current.MainWindow;

            TextBoxDiameter     = mainWindow.TextBoxDiameter;
            ComboBoxEnvironment = mainWindow.ComboBoxEnvironment;
        }
        protected ControlOnCanvas(ControlOnCanvasSer ser)
        {
            controlOnCanvasSer = ser;
            Rotate             = ser.Transform;
            ZIndex             = ser.ZIndex;

            MainWindow mainWindow = (MainWindow)Application.Current.MainWindow;

            CoordinateX   = mainWindow.CoordinateObjectX;
            CoordinateY   = mainWindow.CoordinateObjectY;
            LabelSelected = mainWindow.LabelSelected;

            this.RenderTransform = RotateTransform;

            ContextMenu contextMenu = new ContextMenu();

            Image properties = new Image();

            properties.Source = new BitmapImage(new Uri("Images/SettingEditor.png", UriKind.Relative));

            Image rotateLeft90 = new Image();

            rotateLeft90.Source = new BitmapImage(new Uri("Images/RotateLeft90_16.png", UriKind.Relative));

            Image rotateRight90 = new Image();

            rotateRight90.Source = new BitmapImage(new Uri("Images/RotateRight90_16.png", UriKind.Relative));

            Image deleteImage = new Image();

            deleteImage.Source = new BitmapImage(new Uri("Images/Close16.png", UriKind.Relative));

            Image copyImage = new Image();

            copyImage.Source = new BitmapImage(new Uri("Images/CopyObject16.ico", UriKind.Relative));

            Image cutImage = new Image();

            cutImage.Source = new BitmapImage(new Uri("Images/cut16.png", UriKind.Relative));

            Image forwardImage = new Image();

            forwardImage.Source = new BitmapImage(new Uri("Images/Forward.png", UriKind.Relative));

            Image backwardImage = new Image();

            backwardImage.Source = new BitmapImage(new Uri("Images/Backward.png", UriKind.Relative));

            MenuItem menuItemRotateLeft90 = new MenuItem();

            menuItemRotateLeft90.Click += RotateLeft;
            menuItemRotateLeft90.Icon   = rotateLeft90;
            menuItemRotateLeft90.Header = "Поернуть на 90 влево";

            MenuItem menuItemRotateRight90 = new MenuItem();

            menuItemRotateRight90.Click += RotateRight;
            menuItemRotateRight90.Icon   = rotateRight90;
            menuItemRotateRight90.Header = "Повернуть на 90 вправо";

            menuItemCut        = new MenuItem();
            menuItemCut.Icon   = cutImage;
            menuItemCut.Click += Cut;
            menuItemCut.Header = "Вырезать";

            menuItemCopy        = new MenuItem();
            menuItemCopy.Click += Copy;
            menuItemCopy.Icon   = copyImage;
            menuItemCopy.Header = "Копировать";

            menuItemProperties        = new MenuItem();
            menuItemProperties.Icon   = properties;
            menuItemProperties.Header = "Свойства";

            menuItemDelete        = new MenuItem();
            menuItemDelete.Click += Delete;
            menuItemDelete.Icon   = deleteImage;
            menuItemDelete.Header = "Удалить";

            menuItemForward        = new MenuItem();
            menuItemForward.Click += Forward;
            menuItemForward.Icon   = forwardImage;
            menuItemForward.Header = "На передний план";

            menuItemBackward        = new MenuItem();
            menuItemBackward.Click += Backward;
            menuItemBackward.Icon   = backwardImage;
            menuItemBackward.Header = "На задний план";

            contextMenu.Items.Add(menuItemRotateLeft90);
            contextMenu.Items.Add(menuItemRotateRight90);
            contextMenu.Items.Add(menuItemCut);
            contextMenu.Items.Add(menuItemCopy);
            contextMenu.Items.Add(menuItemForward);
            contextMenu.Items.Add(menuItemBackward);
            contextMenu.Items.Add(menuItemProperties);
            contextMenu.Items.Add(menuItemDelete);

            this.ContextMenu = contextMenu;
        }
 protected ControlOnCanvasPage(ControlOnCanvasSer ser)
     : base(ser)
 {
     ser.ControlItem = this;
 }