Parcourir la source

compdfkit(win) - 测量Demo 直线测量属性面板

liyuxuan il y a 1 an
Parent
commit
ada76721a6

+ 39 - 3
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFMeasureBarControl.xaml.cs

@@ -1,9 +1,11 @@
 using ComPDFKit.PDFAnnotation.Form;
 using Compdfkit_Tools.Measure;
+using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
+using System.Diagnostics;
 using System.Linq;
 using System.Runtime.CompilerServices;
 using System.Text;
@@ -153,10 +155,33 @@ namespace Compdfkit_Tools.PDFControl
 
         public void InitWithPDFViewer(CPDFViewer pdfViewer, MeasurePropertyControl FromProperty)
         {
+           
+            if(this.pdfViewer!=null)
+            {
+                this.pdfViewer.AnnotActiveHandler -= PdfViewer_AnnotActiveHandler;
+            }
             this.pdfViewer = pdfViewer;
+            pdfViewer.AnnotActiveHandler -= PdfViewer_AnnotActiveHandler;
+            pdfViewer.AnnotActiveHandler += PdfViewer_AnnotActiveHandler;
             measurePropertyControl = FromProperty;
         }
 
+        private void PdfViewer_AnnotActiveHandler(object sender, AnnotAttribEvent e)
+        {
+            if (e != null)
+            {
+                if(e.IsAnnotCreateReset)
+                {
+                    List<AnnotHandlerEventArgs> argsList = e.GetAnnotHandlerEventArgs(e.GetAnnotTypes());
+                    measurePropertyControl.SetPropertyForMeasureCreate(argsList[0]);
+                }
+                else
+                {
+                    measurePropertyControl.SetPorpertyForMeasureModify(e);
+                }
+            }
+        }
+
         public void ClearAllToolState()
         {
             foreach (UIElement child in MeasureGrid.Children)
@@ -182,7 +207,7 @@ namespace Compdfkit_Tools.PDFControl
         private void MeasureBtn_Click(object sender, RoutedEventArgs e)
         {
             ClearToolState(sender as ToggleButton);
-            measurePropertyControl.SetPropertyForType(null, null);
+            measurePropertyControl.SetPropertyForMeasureCreate(null);
             if ((bool)(sender as ToggleButton).IsChecked)
             {
                 switch (StringToType((sender as ToggleButton).Tag.ToString()))
@@ -204,7 +229,6 @@ namespace Compdfkit_Tools.PDFControl
                     default:
                         break;
                 }
-                pdfViewer.SetMouseMode(MouseModes.AnnotCreate);
             }
             else
             {
@@ -218,7 +242,17 @@ namespace Compdfkit_Tools.PDFControl
 
         private void CreateStraightness()
         {
-
+            LineMeasureArgs lineMeasureArgs = new LineMeasureArgs();
+            lineMeasureArgs.LineColor = Colors.Red;
+            lineMeasureArgs.LineWidth = 2;
+            lineMeasureArgs.Transparency = 1;
+            lineMeasureArgs.FontColor= Colors.Red;
+            lineMeasureArgs.FontName = "Arial";
+            lineMeasureArgs.FontSize = 14;
+            pdfViewer?.ClearSelectAnnots();
+            pdfViewer?.SetMouseMode(MouseModes.AnnotCreate);
+            pdfViewer?.SetToolParam(lineMeasureArgs);
+            measurePropertyControl.SetPropertyForMeasureCreate(lineMeasureArgs);
         }
 
         private void CreateMultiline()
@@ -237,5 +271,7 @@ namespace Compdfkit_Tools.PDFControl
         }
 
         #endregion
+
+
     }
 }

+ 2 - 1
Demo/Examples/Compdfkit_Tools/Measure/MeasureControl.xaml.cs

@@ -1,5 +1,6 @@
 using Compdfkit_Tools.Helper;
 using Compdfkit_Tools.PDFControl;
+using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
 using System;
 using System.Collections.Generic;
@@ -44,7 +45,7 @@ namespace Compdfkit_Tools.Measure
             PDFMeasureTool.InitWithPDFViewer(pdfViewer, measurePropertyControl);
             FloatPageTool.InitWithPDFViewer(pdfViewer);
             PDFGrid.Child = PdfViewControl;
-
+            panelState.PropertyChanged -= PanelState_PropertyChanged;
             panelState.PropertyChanged += PanelState_PropertyChanged;
         }
 

+ 15 - 7
Demo/Examples/Compdfkit_Tools/Measure/MeasurePropertyControl.xaml.cs

@@ -27,17 +27,13 @@ namespace Compdfkit_Tools.Measure
         public MeasurePropertyControl()
         {
             InitializeComponent();
-
-            //MultilineProperty pushButtonProperty2 = new MultilineProperty();
-            //MeasurePropertyPanel.Child = pushButtonProperty2;
         }
 
-        public void SetPropertyForType(AnnotHandlerEventArgs Args, AnnotAttribEvent e)
+        public void SetPropertyForMeasureCreate(AnnotHandlerEventArgs Args)
         {
-            currentPanel = null;
             if (Args == null)
             {
-                SetMeasurePanel(currentPanel);
+                ClearMeasurePanel();
                 return;
             }
 
@@ -45,7 +41,8 @@ namespace Compdfkit_Tools.Measure
             {
                 case AnnotArgsType.LineMeasure:
                     MultilineProperty multilineProperty = new MultilineProperty();
-                    currentPanel = multilineProperty;
+                    multilineProperty.SetAnnotEventData((LineMeasureArgs)Args);
+                     currentPanel = multilineProperty;
                     break;
                 case AnnotArgsType.PolyLineMeasure:
                     PolygonalProperty polygonalProperty = new PolygonalProperty();
@@ -65,5 +62,16 @@ namespace Compdfkit_Tools.Measure
         {
             MeasurePropertyPanel.Child = newChild;
         }
+
+        public void ClearMeasurePanel()
+        {
+            currentPanel = null;
+            MeasurePropertyPanel.Child = null;
+        }
+
+        public void SetPorpertyForMeasureModify(AnnotAttribEvent annotEvent)
+        {
+
+        }
     }
 }

+ 48 - 7
Demo/Examples/Compdfkit_Tools/Measure/Property/MultilineProperty.xaml

@@ -3,7 +3,9 @@
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-             xmlns:local="clr-namespace:Compdfkit_Tools.Measure.Property" xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common" xmlns:cpdftools="clr-namespace:Compdfkit_Tools.PDFControl"
+             xmlns:local="clr-namespace:Compdfkit_Tools.Measure.Property" 
+             xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common" 
+             xmlns:cpdftools="clr-namespace:Compdfkit_Tools.PDFControl"
              mc:Ignorable="d"  >
     <UserControl.Resources>
         <ResourceDictionary>
@@ -22,23 +24,35 @@
                 </Border>
                 <StackPanel Height="68" Margin="5">
                     <TextBlock Text="Line Color" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
-                    <cpdfcommon:ColorPickerControl Margin="0,8,0,0" x:Name="BorderColorPickerControl" Brush="Red" TransparentBtnProperty ="Collapsed"></cpdfcommon:ColorPickerControl>
+                    <cpdfcommon:ColorPickerControl Margin="0,8,0,0" x:Name="BorderColorPickerControl" Brush="Red" TransparentBtnProperty ="Collapsed"
+                                                   ColorChanged="BorderColorPickerControl_ColorChanged"></cpdfcommon:ColorPickerControl>
                 </StackPanel>
                 <StackPanel Height="68" Margin="5">
                     <TextBlock Text="Opacity" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
-                    <cpdfcommon:CPDFOpacityControl Margin="0,8,0,0" x:Name="CPDFOpacityControl"></cpdfcommon:CPDFOpacityControl>
+                    <cpdfcommon:CPDFOpacityControl Margin="0,8,0,0" x:Name="CPDFOpacityControl" OpacityChanged="CPDFOpacityControl_OpacityChanged">
+                    </cpdfcommon:CPDFOpacityControl>
                 </StackPanel>
                 <StackPanel Height="68" Margin="5">
                     <TextBlock Text="Line Width" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"></TextBlock>
-                    <cpdfcommon:CPDFThicknessControl Margin="0,8,0,0" x:Name="CPDFThicknessControl"></cpdfcommon:CPDFThicknessControl>
+                    <cpdfcommon:CPDFThicknessControl Margin="0,8,0,0" x:Name="CPDFThicknessControl" 
+                                                     ThicknessChanged="CPDFThicknessControl_ThicknessChanged">
+                    </cpdfcommon:CPDFThicknessControl>
                 </StackPanel>
                 <StackPanel x:Name="LineStyleStackPanel" Height="90" Margin="5">
                     <TextBlock Text="Line and Border Style" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
-                    <cpdfcommon:CPDFLineStyleControl Margin="0,8,0,0" x:Name="CPDFLineStyleControl"></cpdfcommon:CPDFLineStyleControl>
+                    <cpdfcommon:CPDFLineStyleControl Margin="0,8,0,0" x:Name="CPDFLineStyleControl" 
+                                                     LineStyleChanged="CPDFLineStyleControl_LineStyleChanged">
+                    </cpdfcommon:CPDFLineStyleControl>
+                </StackPanel>
+                <StackPanel x:Name="ArrowStackPanel" Visibility="Visible" Height="75"  Margin="5">
+                    <TextBlock Text="Start and End" Margin="0,0,0,10"></TextBlock>
+                    <cpdfcommon:CPDFArrowControl x:Name="CPDFArrowControl" ArrowChanged="CPDFArrowControl_ArrowChanged">
+                    </cpdfcommon:CPDFArrowControl>
                 </StackPanel>
                 <StackPanel x:Name="FontColorStackPanel" Height="75" Margin="5">
                     <TextBlock Text="Font Color" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
-                    <cpdfcommon:ColorPickerControl Margin="0,8,0,0" x:Name="FillColorPickerControl" Brush="Transparent"></cpdfcommon:ColorPickerControl>
+                    <cpdfcommon:ColorPickerControl Margin="0,8,0,0" x:Name="FillColorPickerControl" Brush="Transparent"
+                                                   ColorChanged="FillColorPickerControl_ColorChanged"></cpdfcommon:ColorPickerControl>
                 </StackPanel>
                 <StackPanel Margin="5">
                     <TextBlock  Margin="0,20,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Text="Text" FontSize="14" FontFamily="Segoe UI" FontWeight="Bold" />
@@ -54,7 +68,34 @@
                             <ComboBoxItem Content="Italic"/>
                             <ComboBoxItem Content="Bold Italic"/>
                         </ComboBox>
-                        <ComboBox x:Name="FontSizeCombox" Margin="4,8,0,0" Width="80" Style="{StaticResource ComboBoxStyle1}" SelectedIndex="0" SelectionChanged="FontSizeCombox_SelectionChanged"/>
+                        <Grid Grid.Row="1" Grid.Column="1" Margin="8,8,0,0">
+                            <ComboBox Name="FontSizeComboBox" Width="72" Height="28" BorderThickness="1" MaxDropDownHeight="200" Foreground="#43474D" FontSize="14"
+                                      SelectionChanged="FontSizeComboBox_SelectionChanged" Style="{StaticResource ComboBoxStyle1}">
+                                <ComboBoxItem>6</ComboBoxItem>
+                                <ComboBoxItem>8</ComboBoxItem>
+                                <ComboBoxItem>9</ComboBoxItem>
+                                <ComboBoxItem>10</ComboBoxItem>
+                                <ComboBoxItem>12</ComboBoxItem>
+                                <ComboBoxItem>14</ComboBoxItem>
+                                <ComboBoxItem>18</ComboBoxItem>
+                                <ComboBoxItem>20</ComboBoxItem>
+                                <ComboBoxItem>22</ComboBoxItem>
+                                <ComboBoxItem>24</ComboBoxItem>
+                                <ComboBoxItem>26</ComboBoxItem>
+                                <ComboBoxItem>28</ComboBoxItem>
+                                <ComboBoxItem>32</ComboBoxItem>
+                                <ComboBoxItem>36</ComboBoxItem>
+                                <ComboBoxItem>48</ComboBoxItem>
+                                <ComboBoxItem>72</ComboBoxItem>
+                            </ComboBox>
+                            <TextBox Name="FontSizeTextBox" IsHitTestVisible="False" Width="72" Height="28" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" BorderThickness="1"
+                                     IsReadOnly="True"  Padding="0,0,15,0" FontSize="14"></TextBox>
+                            <Path Fill="#43474D" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,5,0" IsHitTestVisible="False">
+                                <Path.Data>
+                                    M0.5 0.510248L4.5041 5.5L8.5 0.5L0.5 0.510248Z
+                                </Path.Data>
+                            </Path>
+                        </Grid>
                     </StackPanel>
                 </StackPanel>
                 <StackPanel Height="160" Margin="5">

+ 253 - 4
Demo/Examples/Compdfkit_Tools/Measure/Property/MultilineProperty.xaml.cs

@@ -1,5 +1,11 @@
-using System;
+using ComPDFKit.PDFAnnotation;
+using Compdfkit_Tools.Common;
+using Compdfkit_Tools.Data;
+using ComPDFKitViewer;
+using ComPDFKitViewer.AnnotEvent;
+using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -20,6 +26,7 @@ namespace Compdfkit_Tools.Measure.Property
     /// </summary>
     public partial class MultilineProperty : UserControl
     {
+        private AnnotAttribEvent LineEvent { get; set; }
         public MultilineProperty()
         {
             InitializeComponent();
@@ -27,22 +34,264 @@ namespace Compdfkit_Tools.Measure.Property
 
         private void NoteTextBox_TextChanged(object sender, TextChangedEventArgs e)
         {
-
+            LineEvent.UpdateAttrib(AnnotAttrib.NoteText, NoteTextBox.Text);
+            LineEvent.UpdateAnnot();
         }
 
         private void FontStyleCombox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
+            int selectIndex = Math.Max(0, FontStyleCombox.SelectedIndex);
+            bool isBold = false;
+            bool isItalic = false;
 
+            switch (selectIndex)
+            {
+                case 0:
+                    isBold = false;
+                    isItalic = false;
+                    break;
+                case 1:
+                    isBold = true;
+                    isItalic = false;
+                    break;
+                case 2:
+                    isBold = false;
+                    isItalic = true;
+                    break;
+                case 3:
+                    isBold = true;
+                    isItalic = true;
+                    break;
+                default:
+                    break;
+            }
+            LineEvent?.UpdateAttrib(AnnotAttrib.IsBold, isBold);
+            LineEvent?.UpdateAttrib(AnnotAttrib.IsItalic, isItalic);
+            LineEvent?.UpdateAnnot();
         }
 
-        private void FontSizeCombox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        private void FontSizeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
-
+            ComboBoxItem selectItem = FontSizeComboBox.SelectedItem as ComboBoxItem;
+            if (selectItem != null && selectItem.Content != null)
+            {
+                if (int.TryParse(selectItem.Content.ToString(), out int newFontSize))
+                {
+                    FontSizeTextBox.Text = (newFontSize).ToString();
+                    LineEvent?.UpdateAttrib(AnnotAttrib.FontSize, newFontSize);
+                    LineEvent?.UpdateAnnot();
+                }
+            }
         }
 
         private void FontCombox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
+            ComboBoxItem selectItem = FontCombox.SelectedItem as ComboBoxItem;
+            if (selectItem != null && selectItem.Content != null)
+            {
+                LineEvent?.UpdateAttrib(AnnotAttrib.FontName, selectItem.Content.ToString());
+                LineEvent?.UpdateAnnot();
+            }
+        }
+
+        private void BorderColorPickerControl_ColorChanged(object sender, EventArgs e)
+        {
+            SolidColorBrush checkBrush = BorderColorPickerControl.GetBrush() as SolidColorBrush;
+            if (checkBrush != null)
+            {
+                LineEvent?.UpdateAttrib(AnnotAttrib.Color, checkBrush.Color);
+                LineEvent?.UpdateAnnot();
+            }
+        }
+
+        private void CPDFOpacityControl_OpacityChanged(object sender, EventArgs e)
+        {
+            LineEvent?.UpdateAttrib(AnnotAttrib.Transparency, CPDFOpacityControl.OpacityValue/100D*255D);
+            LineEvent?.UpdateAnnot();
+        }
+
+        public void SetAnnotEventData(AnnotAttribEvent annotEvent)
+        {
+            LineEvent = null;
+            if(annotEvent!=null)
+            {
+                foreach(AnnotAttrib attrib in annotEvent.Attribs.Keys)
+                {
+                    switch(attrib)
+                    {
+                        case AnnotAttrib.Color:
+                            BorderColorPickerControl.SetCheckedForColor((Color)annotEvent.Attribs[attrib]);
+                            break;
+                        case AnnotAttrib.Transparency:
+                            double transparennt= Convert.ToDouble(annotEvent.Attribs[attrib]);
+                            if(transparennt>1)
+                            {
+                                transparennt =(transparennt / 255D);
+                            }
+                            CPDFOpacityControl.OpacityValue = (int)(transparennt*100);
+                            break;
+                        case AnnotAttrib.Thickness:
+                            CPDFThicknessControl.Thickness = Convert.ToInt16(annotEvent.Attribs[attrib]);
+                            break;
+                        case AnnotAttrib.LineStyle:
+                            CPDFLineStyleControl.DashStyle= (DashStyle)(annotEvent.Attribs[attrib]);
+                            break;
+                        case AnnotAttrib.FontColor:
+                            FillColorPickerControl.SetCheckedForColor((Color)annotEvent.Attribs[attrib]);
+                            break;
+                        case AnnotAttrib.FontName:
+                            {
+                                string fontName= (string)annotEvent.Attribs[AnnotAttrib.FontName];
+                                if (fontName == "Courier New")
+                                {
+                                    FontCombox.SelectedIndex = 1;
+                                }
+                                else if (fontName == "Arial")
+                                {
+                                    FontCombox.SelectedIndex = 0;
 
+                                }
+                                else if (fontName.Contains("Times"))
+                                {
+                                    FontCombox.SelectedIndex = 2;
+                                }
+                                else
+                                {
+                                    FontCombox.SelectedIndex = -1;
+                                }
+                            }
+                            break;
+                        case AnnotAttrib.FontSize:
+                            SetFontSize(Convert.ToDouble(annotEvent.Attribs[attrib]));
+                            break;
+                        default:
+                            break;
+                    }
+                }
+
+                C_LINE_TYPE headLineType = C_LINE_TYPE.LINETYPE_NONE;
+                C_LINE_TYPE tailLineType = C_LINE_TYPE.LINETYPE_NONE;
+
+                if(annotEvent.Attribs.ContainsKey(AnnotAttrib.LineStart))
+                {
+                    headLineType = (C_LINE_TYPE)annotEvent.Attribs[AnnotAttrib.LineStart];
+                }
+                if (annotEvent.Attribs.ContainsKey(AnnotAttrib.LineEnd))
+                {
+                    tailLineType = (C_LINE_TYPE)annotEvent.Attribs[AnnotAttrib.LineEnd];
+                }
+                LineType lineType = new LineType()
+                {
+                    HeadLineType = headLineType,
+                    TailLineType = tailLineType
+                };
+                CPDFArrowControl.LineType = lineType;
+
+                bool isBold=false; 
+                bool isItalic=false;
+                if (annotEvent.Attribs.ContainsKey(AnnotAttrib.IsBold))
+                {
+                    isBold = (bool)annotEvent.Attribs[AnnotAttrib.IsBold];
+                }
+                if (annotEvent.Attribs.ContainsKey(AnnotAttrib.IsItalic))
+                {
+                    isItalic = (bool)annotEvent.Attribs[AnnotAttrib.IsItalic];
+                }
+
+                SetFontStyle(isBold, isItalic);
+            }
+
+            LineEvent =annotEvent;
+        }
+
+        public void SetAnnotEventData(LineMeasureArgs annotArgs)
+        {
+            Dictionary<AnnotAttrib, object> attribDict = new Dictionary<AnnotAttrib, object>();
+            attribDict[AnnotAttrib.Color] = annotArgs.LineColor;
+            attribDict[AnnotAttrib.Transparency] = annotArgs.Transparency;
+            attribDict[AnnotAttrib.Thickness] = annotArgs.LineWidth;
+            attribDict[AnnotAttrib.LineStyle] = annotArgs.LineDash;
+            attribDict[AnnotAttrib.LineStart] = annotArgs.HeadLineType;
+            attribDict[AnnotAttrib.LineEnd] = annotArgs.TailLineType;
+            attribDict[AnnotAttrib.FontColor] = annotArgs.FontColor;
+            attribDict[AnnotAttrib.FontName] = annotArgs.FontName;
+            attribDict[AnnotAttrib.IsBold] = annotArgs.IsBold;
+            attribDict[AnnotAttrib.IsItalic] = annotArgs.IsItalic;
+            attribDict[AnnotAttrib.FontSize] = annotArgs.FontSize;
+            attribDict[AnnotAttrib.NoteText] = annotArgs.Content;
+
+            AnnotAttribEvent annotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annotArgs, attribDict);
+            SetAnnotEventData(annotEvent);
+        }
+
+        public void SetFontStyle(bool isBold, bool isItalic)
+        {
+            if (isBold == false && isItalic == false)
+            {
+                FontStyleCombox.SelectedIndex = 0;
+                return;
+            }
+
+            if (isBold && isItalic == false)
+            {
+                FontStyleCombox.SelectedIndex = 1;
+                return;
+            }
+
+            if (isBold == false && isItalic)
+            {
+                FontStyleCombox.SelectedIndex = 2;
+                return;
+            }
+
+            if (isBold && isItalic)
+            {
+                FontStyleCombox.SelectedIndex = 3;
+            }
+        }
+
+        public void SetFontSize(double newFontSize)
+        {
+            if (FontSizeTextBox != null)
+            {
+                if (newFontSize - (int)(newFontSize) > 0)
+                {
+                    FontSizeTextBox.Text = ((int)newFontSize).ToString();
+                }
+                else
+                {
+                    FontSizeTextBox.Text = ((int)(newFontSize)).ToString();
+                }
+            }
+        }
+
+        private void CPDFThicknessControl_ThicknessChanged(object sender, EventArgs e)
+        {
+            LineEvent?.UpdateAttrib(AnnotAttrib.Thickness, CPDFThicknessControl.Thickness);
+            LineEvent?.UpdateAnnot();
+        }
+
+        private void CPDFLineStyleControl_LineStyleChanged(object sender, EventArgs e)
+        {
+            LineEvent?.UpdateAttrib(AnnotAttrib.LineStyle, CPDFLineStyleControl.DashStyle);
+            LineEvent?.UpdateAnnot();
+        }
+
+        private void CPDFArrowControl_ArrowChanged(object sender, EventArgs e)
+        {
+            LineEvent?.UpdateAttrib(AnnotAttrib.LineStart, CPDFArrowControl.LineType.HeadLineType);
+            LineEvent?.UpdateAttrib(AnnotAttrib.LineEnd, CPDFArrowControl.LineType.TailLineType);
+            LineEvent?.UpdateAnnot();
+        }
+
+        private void FillColorPickerControl_ColorChanged(object sender, EventArgs e)
+        {
+            SolidColorBrush checkBrush = BorderColorPickerControl.GetBrush() as SolidColorBrush;
+            if (checkBrush != null)
+            {
+                LineEvent?.UpdateAttrib(AnnotAttrib.FontColor, checkBrush.Color);
+                LineEvent?.UpdateAnnot();
+            }
         }
     }
 }

+ 3 - 1
Demo/Examples/Measure/MainWindow.xaml.cs

@@ -795,6 +795,7 @@ namespace Measure
 
         private void LoadMeasureRes()
         {
+            FloatPageTool.Visibility = Visibility.Collapsed;
             PDFGrid.Child = null;
             RightPanelButton.Visibility = Visibility.Visible;
             PDFGrid.Child = measureControl;
@@ -810,7 +811,6 @@ namespace Measure
             {
                 measureControl.ClearAllToolState();
                 measureControl.ExpandNullRightPropertyPanel(Visibility.Collapsed);
-                //formControl.FromPropertyControl.AnnotationCancel();
                 RightPanelButton.IsChecked = false;
                 if (pdfViewControl != null && pdfViewControl.PDFView != null)
                 {
@@ -819,6 +819,8 @@ namespace Measure
                 RightPanelButton.Visibility=Visibility.Collapsed;
                 measureControl.ClearViewerControl();
                 PDFGrid.Child = pdfViewControl;
+                FloatPageTool.Visibility = Visibility.Visible;
+                FloatPageTool.InitWithPDFViewer(pdfViewControl.PDFView);
             }
             else if ((string)item.Content == "Measure")
             {

+ 2 - 1
Demo/Examples/Measure/Measure.csproj

@@ -33,7 +33,7 @@
     <BootstrapperEnabled>true</BootstrapperEnabled>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <PlatformTarget>AnyCPU</PlatformTarget>
+    <PlatformTarget>x64</PlatformTarget>
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
@@ -41,6 +41,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>

BIN
Demo/Examples/packages/ComPDFKit.NetFramework.1.9.1/build/x64/ComPDFKit.dll