Пример #1
0
 private void Part_FontColor_SelectedBrushChanged(object sender, SelectedBrushChangedEventArgs e)
 {
     if (this.diagramControl != null)
     {
         var selectedItem = this.diagramControl.SelectedItems as SelectorViewModel;
         foreach (INode node in selectedItem.Nodes as IEnumerable <object> )
         {
             if (node.Annotations is IEnumerable <IAnnotation> )
             {
                 foreach (IAnnotation annotation in node.Annotations as IEnumerable <IAnnotation> )
                 {
                     annotation.Foreground = e.NewBrush;
                 }
             }
         }
         foreach (IConnector connector in selectedItem.Connectors as IEnumerable <object> )
         {
             if (connector.Annotations is IEnumerable <IAnnotation> )
             {
                 foreach (IAnnotation annotation in connector.Annotations as IEnumerable <IAnnotation> )
                 {
                     annotation.Foreground = e.NewBrush;
                 }
             }
         }
     }
 }
Пример #2
0
        private void Part_StrokeColor_SelectedBrushChanged(object sender, SelectedBrushChangedEventArgs e)
        {
            if (this.diagramControl != null)
            {
                var selectedItem = this.diagramControl.SelectedItems as SelectorViewModel;
                foreach (INode node in selectedItem.Nodes as IEnumerable <object> )
                {
                    var newStyle = new Style()
                    {
                        TargetType = typeof(System.Windows.Shapes.Path)
                    };
                    foreach (Setter setter in node.ShapeStyle.Setters)
                    {
                        if (setter.Property.Name == "Stroke")
                        {
                            newStyle.Setters.Add(new Setter()
                            {
                                Property = Path.StrokeProperty, Value = (SolidColorBrush) new BrushConverter().ConvertFromString(e.NewColor.ToString())
                            });
                        }
                        else
                        {
                            newStyle.Setters.Add(setter);
                        }
                    }

                    node.ShapeStyle = newStyle;
                }
            }
        }
Пример #3
0
 private void Part_FillColor_SelectedBrushChanged(object sender, SelectedBrushChangedEventArgs e)
 {
     if (this.diagramControl != null)
     {
         var selectedItem = this.diagramControl.SelectedItems as SelectorViewModel;
         foreach (INode node in selectedItem.Nodes as IEnumerable <object> )
         {
             (node as FloorPlanNode).FillColor = (SolidColorBrush) new BrushConverter().ConvertFromString(e.NewColor.ToString());
         }
     }
 }
Пример #4
0
        private static void C_SelectedBrushChanged(object sender, SelectedBrushChangedEventArgs e)
        {
            ColorPickerPalette box = (sender as ColorPickerPalette);

            if (box != null)
            {
                ICommand command = box.GetValue(CommandProperty) as ICommand;
                if (command != null)
                {
                    command.Execute(box.Color);
                }
            }
        }
Пример #5
0
        private void ForegroundColorPicker_SelectedBrushChanged(object sender, SelectedBrushChangedEventArgs e)
        {
            var         color      = this.ForegroundColorPicker.Color;
            GridControl ActiveGrid = ((tControl.SelectedItem as TabItem).Content as ScrollViewer).Content as GridControl;

            if (ActiveGrid != null)
            {
                GridRangeInfoList rangeList = ActiveGrid.Model.SelectedRanges;
                foreach (GridRangeInfo range in rangeList)
                {
                    for (int row = range.Top; row <= range.Bottom; row++)
                    {
                        for (int col = range.Left; col <= range.Right; col++)
                        {
                            ActiveGrid.Model[row, col].Foreground = new SolidColorBrush(color);
                        }
                    }
                    ActiveGrid.InvalidateCell(range);
                }
                ActiveGrid.InvalidateVisual();
            }
            this.ForeColorSplitButton.IsDropDownOpen = false;
        }
Пример #6
0
        void RaiseSelectedBrushChanged(Brush brush)
        {
            var arg = new SelectedBrushChangedEventArgs(brush, SelectedBrushChangedEvent);

            RaiseEvent(arg);
        }
Пример #7
0
 private void BackgroundColorPickerPalatte_SelectedBrushChanged(object sender, SelectedBrushChangedEventArgs e)
 {
     if (this.diagramControl != null && this.diagramControl.PageSettings != null)
     {
         this.diagramControl.PageSettings.PageBackground = e.NewBrush;
     }
 }