Ejemplo n.º 1
0
        private void PenSizeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            WpfAnnotationUI ann = this.AnnotationViewer.Annotations.ActiveAnnotation;

            if (ann == null)
            {
                return;
            }

            if (this.PenSizeSlider.Value == 0)
            {
                ann.SetValue(WpfAnnotationUI.OutlineProperty, null);
            }
            else
            {
                AnnotationPen pen = (AnnotationPen)ann.GetValue(WpfAnnotationUI.OutlineProperty);
                if (pen == null)
                {
                    Color clr = Colors.Black;
                    if (this.OutlineComboBox.SelectedIndex > -1)
                    {
                        clr = ((KeyValuePair <string, Color>) this.OutlineComboBox.SelectedItem).Value;
                    }

                    pen = new AnnotationPen(WpfObjectConverter.ConvertColor(clr), (float)this.PenSizeSlider.Value);
                    ann.SetValue(WpfAnnotationUI.OutlineProperty, pen);
                }
                else
                {
                    pen.Width = (float)this.PenSizeSlider.Value;
                }
            }
        }
Ejemplo n.º 2
0
        private void OutlineComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            WpfAnnotationUI ann = this.AnnotationViewer.Annotations.ActiveAnnotation;

            if (ann == null)
            {
                return;
            }

            KeyValuePair <string, Color> val = (KeyValuePair <string, Color>) this.OutlineComboBox.SelectedItem;

            AnnotationPen pen = (AnnotationPen)ann.GetValue(WpfAnnotationUI.OutlineProperty);

            if (pen == null)
            {
                if (this.PenSizeSlider.Value > 0)
                {
                    pen = new AnnotationPen(WpfObjectConverter.ConvertColor(val.Value), (float)this.PenSizeSlider.Value);
                    ann.SetValue(WpfAnnotationUI.OutlineProperty, pen);
                }
            }
            else
            {
                pen.Color = WpfObjectConverter.ConvertColor(val.Value);
            }
        }
Ejemplo n.º 3
0
        private void ShadowCheckBox_Unchecked(object sender, RoutedEventArgs e)
        {
            WpfAnnotationUI ann = this.AnnotationViewer.Annotations.ActiveAnnotation;

            if (ann != null)
            {
                ann.SetValue(WpfAnnotationUI.ShadowProperty, null);
            }
        }
Ejemplo n.º 4
0
        private void ShadowCheckBox_Checked(object sender, RoutedEventArgs e)
        {
            WpfAnnotationUI ann = this.AnnotationViewer.Annotations.ActiveAnnotation;

            if (ann != null)
            {
                ann.SetValue(WpfAnnotationUI.ShadowProperty, new AnnotationBrush(System.Drawing.Color.FromArgb(120, System.Drawing.Color.Silver)));
            }
        }
Ejemplo n.º 5
0
        private void OffsetSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            WpfAnnotationUI ann = this.AnnotationViewer.Annotations.ActiveAnnotation;

            if (ann != null)
            {
                ann.SetValue(WpfAnnotationUI.ShadowOffsetProperty, new Point(e.NewValue, e.NewValue));
            }
        }
Ejemplo n.º 6
0
        private void FillComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            WpfAnnotationUI ann = this.AnnotationViewer.Annotations.ActiveAnnotation;

            if (ann == null)
            {
                return;
            }

            KeyValuePair <string, Color> val = (KeyValuePair <string, Color>) this.FillComboBox.SelectedItem;

            AnnotationBrush brush = (AnnotationBrush)ann.GetValue(WpfAnnotationUI.FillProperty);

            if (brush == null)
            {
                brush = new AnnotationBrush(WpfObjectConverter.ConvertColor(val.Value));
                ann.SetValue(WpfAnnotationUI.FillProperty, brush);
            }
            else
            {
                brush.Color = WpfObjectConverter.ConvertColor(val.Value);
            }
        }