Explorar o código

Merge branch 'dev' of http://git.kdan.cc:8865/Windows/PDFOffice_Windows_exe into dev

ZhouJieSheng %!s(int64=2) %!d(string=hai) anos
pai
achega
4551499434

+ 3 - 2
PDF Office/App.xaml.cs

@@ -75,6 +75,7 @@ namespace PDF_Office
         /// 产品名称
         /// </summary>
         public static string Name = "PDF Office";
+
         /// <summary>
         /// 当前app版本号
         /// </summary>
@@ -137,7 +138,6 @@ namespace PDF_Office
                 //重置用于弹窗的记录参数
             }
 
-
             if (Settings.Default.RecentOpenFiles == null)
                 Settings.Default.RecentOpenFiles = new RecentOpenFiles();
 
@@ -360,7 +360,8 @@ namespace PDF_Office
             containerRegistry.RegisterForNavigation<NOInternetRegion>();
             containerRegistry.RegisterForNavigation<UserOutCodeRegion>();
             containerRegistry.RegisterForNavigation<PasswordUpdataRegion>();
-           
+
+            containerRegistry.RegisterForNavigation<StickyNotePopup>();
 
             #endregion 注册内容组件
 

+ 5 - 0
PDF Office/Model/ParameterNames.cs

@@ -77,6 +77,9 @@ namespace PDF_Office.Model
         public static string AnnotationColors = "AnnotationColors";
         public static string AnnotationAuthor = "AnnotationAuthor";
         public static string AnnotationCleanState = "AnnotationCleanState";
+
+        public static string StickyAnnotArgs = "StickyAnnotArgs";
+
         /// <summary>
         /// 底部工具栏
         /// </summary>
@@ -106,6 +109,7 @@ namespace PDF_Office.Model
         /// 打印
         /// </summary>
         public static string PrintQueue = "PrintQueue";
+
         public static string PrintSettingsInfo = "PrintSettingsInfo";
         public static string PrintCurrentPage = "PrintCurrentPage";
 
@@ -113,6 +117,7 @@ namespace PDF_Office.Model
         /// 密码
         /// </summary>
         public static string PasswordKind = "PasswordKind";
+
         public static string PasswordResult = "PasswordResult";
         public static string Password = "Password";
     }

+ 7 - 0
PDF Office/Model/RegionNames.cs

@@ -69,6 +69,13 @@ namespace PDF_Office.Model
                 return GetRegionName("LeftTipContentRegionName");
             }
         }
+        public static string NotePopupRegionName
+        {
+            get
+            {
+                return GetRegionName("NotePopupRegionName");
+            }
+        }
 
         public static string ReadRegionName
         {

+ 1 - 0
PDF Office/PDF Office.csproj

@@ -547,6 +547,7 @@
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\SignatureAnnotPropertyViewModel.cs" />
     <Compile Include="ViewModels\Dialog\SignatureCreateDialogViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\SnapshotEditMenuViewModel.cs" />
+    <Compile Include="ViewModels\PropertyPanel\AnnotPanel\StickyNotePopupViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\StickyNotePropertyViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\PDFEdit\ImageEditPropertyViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\PDFEdit\ImageTextEditPropertyViewModel.cs" />

+ 13 - 6
PDF Office/ViewModels/PropertyPanel/AnnotPanel/LinkAnnotPropertyViewModel.cs

@@ -33,6 +33,7 @@ using System.Windows.Input;
 using Prism.Events;
 using Prism.Services.Dialogs;
 using PDF_Office.Views.BOTA;
+using ImTools;
 
 namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
 {
@@ -712,14 +713,20 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             if (region.Regions.ContainsRegionWithName(viewContentViewModel.TipContentRegionName))
             {
                 var views = region.Regions[viewContentViewModel.TipContentRegionName].Views;
-                foreach (var item in views)
+
+                var isHas = views.FindFirst(q => q is Views.TipContent.LinkAnnotTip);
+                if (isHas != null)
                 {
-                    if (item is Views.TipContent.LinkAnnotTip linkAnnotTip)
-                    {
-                        isExist = true;
-                        break;
-                    }
+
                 }
+                //foreach (var item in views)
+                //{
+                //    if (item is Views.TipContent.LinkAnnotTip linkAnnotTip)
+                //    {
+                //        isExist = true;
+                //        break;
+                //    }
+                //}
             }
             if (isExist == false)
             {

+ 79 - 0
PDF Office/ViewModels/PropertyPanel/AnnotPanel/StickyNotePopupViewModel.cs

@@ -0,0 +1,79 @@
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
+using PDF_Office.Properties;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
+{
+    internal class StickyNotePopupViewModel : BindableBase, INavigationAware
+    {
+        private string authorText;
+
+        public string AuthorText
+        {
+            get { return authorText; }
+            set
+            {
+                SetProperty(ref authorText, value);
+            }
+        }
+
+        private string dateText;
+
+        public string DateText
+        {
+            get { return dateText; }
+            set
+            {
+                SetProperty(ref dateText, value);
+            }
+        }
+
+        private string contentText;
+
+        public string ContentText
+        {
+            get { return contentText; }
+            set
+            {
+                SetProperty(ref contentText, value);
+            }
+        }
+
+        private ViewContentViewModel ViewContentViewModel;
+        public DelegateCommand ContentTextLostFocus { get; set; }
+
+        public StickyNotePopupViewModel()
+        {
+            ContentTextLostFocus = new DelegateCommand(ContentText_LostFocus);
+        }
+
+        private void ContentText_LostFocus()
+        {
+            ViewContentViewModel.IsNoteAdd = false;
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out ViewContentViewModel);
+            AuthorText = Settings.Default.AppProperties.Description.Author;
+            DateText = DateTime.Now.ToString(@"yyyyMMddHHmmsszzz\'").Replace(':', '\'') + "\n";
+        }
+    }
+}

+ 19 - 6
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs

@@ -1083,18 +1083,31 @@ namespace PDF_Office.ViewModels.Tools
 
                         stickyAnnotArgs.ClientRect = new Rect(textSelectNodes[0].StartPoint.X, annotCommand.TextRect.Y - annotCommand.TextRect.Height, annotCommand.TextRect.Width, annotCommand.TextRect.Height);
                         stickyAnnotArgs.StickyNote = annotCommand.Text;
-                        PDFViewer.CreatePageAnnot(annotCommand.PageIndex, stickyAnnotArgs);
+                        //PDFViewer.CreatePageAnnot(annotCommand.PageIndex, stickyAnnotArgs);
 
-                        customStickyPopup = new StickyNotePopup();
-                        PDFViewer.SetStickyNotePop(customStickyPopup);
+                        NavigationParameters param = new NavigationParameters();
+                        param.Add(ParameterNames.PDFViewer, PDFViewer);
+                        param.Add(ParameterNames.StickyAnnotArgs, stickyAnnotArgs);
+                        param.Add(ParameterNames.ViewContentViewModel, viewContentViewModel);
+
+                        viewContentViewModel.NotePopupVisible = Visibility.Visible;
+                        viewContentViewModel.CanvasNoteLeft = annotCommand.TextRect.X;
+                        viewContentViewModel.CanvasNoteTop = annotCommand.TextRect.Y;
+                        viewContentViewModel.IsNoteAdd = true;
+                        region.RequestNavigate(viewContentViewModel.NotePopupRegionName, "StickyNotePopup", param);
+                        //customStickyPopup.SetAuthor(Settings.Default.AppProperties.Description.Author);
+                        //customStickyPopup.SetDateText(DateTime.Now.ToString(@"yyyyMMddHHmmsszzz\'").Replace(':', '\''));
+
+                        //customStickyPopup = new StickyNotePopup();
+                        //PDFViewer.SetStickyNotePop(customStickyPopup);
 
                         //customStickyPopup.GetCurrentAnnot = stickyAnnotArgs;
                         //customStickyPopup.GetPDFViewer = PDFViewer;
                         //stickyAnnotArgs.Author = Settings.Default.AppProperties.Description.Author;
-                        PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
-                        PDFViewer.SetToolParam(stickyAnnotArgs);
+                        //PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
+                        //PDFViewer.SetToolParam(stickyAnnotArgs);
 
-                        PDFViewer.SetMouseMode(MouseModes.PanTool);
+                        //PDFViewer.SetMouseMode(MouseModes.PanTool);
                         break;
 
                     case "Rect"://矩形

+ 41 - 4
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -230,6 +230,9 @@ namespace PDF_Office.ViewModels
 
         public string LeftTipContentRegionName { get; set; }
 
+        //便签弹窗
+        public string NotePopupRegionName { get; set; }
+
         public string ReadModeRegionName { get; set; }
 
         public string ConverterBarContentRegionName { get; set; }
@@ -270,14 +273,37 @@ namespace PDF_Office.ViewModels
             }
         }
 
-        private Visibility readModelTip = Visibility.Collapsed;
+        private Visibility notePopupVisible = Visibility.Collapsed;
+
+        public Visibility NotePopupVisible
+        {
+            get { return notePopupVisible; }
+            set
+            {
+                SetProperty(ref notePopupVisible, value);
+            }
+        }
+
+        public bool IsNoteAdd = false;
+        private double canvasNoteLeft;
+
+        public double CanvasNoteLeft
+        {
+            get { return canvasNoteLeft; }
+            set
+            {
+                SetProperty(ref canvasNoteLeft, value);
+            }
+        }
+
+        private double canvasNoteTop;
 
-        public Visibility ReadModelTip
+        public double CanvasNoteTop
         {
-            get { return readModelTip; }
+            get { return canvasNoteTop; }
             set
             {
-                SetProperty(ref readModelTip, value);
+                SetProperty(ref canvasNoteTop, value);
             }
         }
 
@@ -646,6 +672,7 @@ namespace PDF_Office.ViewModels
 
         public DelegateCommand Load { get; set; }
 
+        public DelegateCommand MouseDown { get; set; }
         public DelegateCommand<object> TabControlSelectionChangedCommand { get; set; }
 
         public DelegateCommand SaveFile { get; set; }
@@ -700,6 +727,7 @@ namespace PDF_Office.ViewModels
             unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             LoadFile = new DelegateCommand(loadFile);
             Load = new DelegateCommand(LoadControl);
+            MouseDown = new DelegateCommand(MouseDownEvent);
             SaveFile = new DelegateCommand(() => { saveFile(); }, CanSaveExcute).ObservesProperty(() => CanSave);
             SaveAsFlattenCommand = new DelegateCommand(saveAsFlatten);
             SaveAsFile = new DelegateCommand(() => { saveAsFile(); });
@@ -739,6 +767,7 @@ namespace PDF_Office.ViewModels
             TipVisible = Visibility.Visible;
             TipContentRegionName = RegionNames.TipContentRegionName;
             LeftTipContentRegionName = RegionNames.LeftTipContentRegionName;
+            NotePopupRegionName = RegionNames.NotePopupRegionName;
             OCRViewerRegionName = RegionNames.OCRViewerRegionName;
             ToolContentRegionName = Guid.NewGuid().ToString();
             ToolsBarContentRegionName = Guid.NewGuid().ToString();
@@ -762,6 +791,14 @@ namespace PDF_Office.ViewModels
             EnterSelectedBar("TabItemAnnotation");
         }
 
+        private void MouseDownEvent()
+        {
+            if (NotePopupVisible == Visibility.Visible && IsNoteAdd == false)
+            {
+                NotePopupVisible = Visibility.Collapsed;
+            }
+        }
+
         /// <summary>
         ///创建空白文档
         /// </summary>

+ 137 - 66
PDF Office/Views/PropertyPanel/AnnotPanel/StickyNotePopup.xaml

@@ -1,33 +1,42 @@
-<annotview:StickyPopupExt x:Class="PDF_Office.Views.PropertyPanel.AnnotPanel.StickyNotePopup"
-             xmlns:annotview="clr-namespace:ComPDFKitViewer;assembly=ComPDFKit.Viewer"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             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:PDF_Office.Views.PropertyPanel.AnnotPanel"
-             mc:Ignorable="d" Background="Transparent"
-             d:DesignHeight="450" d:DesignWidth="800">
+<annotview:StickyPopupExt
+    x:Class="PDF_Office.Views.PropertyPanel.AnnotPanel.StickyNotePopup"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:annotview="clr-namespace:ComPDFKitViewer;assembly=ComPDFKit.Viewer"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:prism="http://prismlibrary.com/"
+    xmlns:viewmodels="clr-namespace:PDF_Office.ViewModels.PropertyPanel.AnnotPanel"
+    d:DataContext="{d:DesignInstance Type=viewmodels:StickyNotePopupViewModel}"
+    d:DesignHeight="450"
+    d:DesignWidth="800"
+    prism:ViewModelLocator.AutoWireViewModel="True"
+    Background="Transparent"
+    mc:Ignorable="d">
     <annotview:StickyPopupExt.Resources>
         <DataTemplate x:Key="listboxData">
-            <Ellipse Stroke="{StaticResource color.sys.layout.divider}"
-                     StrokeThickness="1"
-                    Width="20"
-                    Height="20"
-                    Fill="{Binding Color}" />
+            <Ellipse
+                Width="20"
+                Height="20"
+                Fill="{Binding Color}"
+                Stroke="{StaticResource color.sys.layout.divider}"
+                StrokeThickness="1" />
         </DataTemplate>
 
         <Style x:Key="listboxItemStyle" TargetType="{x:Type ListBoxItem}">
             <Setter Property="HorizontalContentAlignment" Value="Center" />
-            <Setter Property="Height" Value="32"/>
-            <Setter Property="Width" Value="32"/>
+            <Setter Property="Height" Value="32" />
+            <Setter Property="Width" Value="32" />
             <Setter Property="Margin" Value="2,0,2,0" />
             <Setter Property="Template">
                 <Setter.Value>
                     <ControlTemplate TargetType="{x:Type ContentControl}">
-                        <Border CornerRadius="4"
-                                x:Name="border"
-                                Padding="0,0"
-                                Background="{TemplateBinding Background}">
+                        <Border
+                            x:Name="border"
+                            Padding="0,0"
+                            Background="{TemplateBinding Background}"
+                            CornerRadius="4">
                             <ContentPresenter />
                         </Border>
                     </ControlTemplate>
@@ -45,55 +54,111 @@
                     <Setter Property="Background" Value="#e2e3e5" />
                 </Trigger>
             </Style.Triggers>
-
         </Style>
     </annotview:StickyPopupExt.Resources>
     <Grid MouseLeftButtonDown="Grid_MouseLeftButtonDown">
-        <Border  x:Name="border" Background="{StaticResource color.sys.layout.anti}" CornerRadius="8" BorderThickness="2" BorderBrush="#ffe49a" MinWidth="240" MinHeight="200" Width="240" Height="200" >
+        <Border
+            x:Name="border"
+            Width="240"
+            Height="200"
+            MinWidth="240"
+            MinHeight="200"
+            Background="{StaticResource color.sys.layout.anti}"
+            BorderBrush="#ffe49a"
+            BorderThickness="2"
+            CornerRadius="8">
             <Border.Effect>
-                <DropShadowEffect BlurRadius="8" Direction="0" Opacity="0.16" ShadowDepth="0" Color="#000000" />
+                <DropShadowEffect
+                    BlurRadius="8"
+                    Direction="0"
+                    Opacity="0.16"
+                    ShadowDepth="0"
+                    Color="#000000" />
             </Border.Effect>
-            <Grid MinWidth="240" MinHeight="200" Background="Transparent" Name="GridUi" Width="240" Height="200">
+            <Grid
+                Name="GridUi"
+                Width="240"
+                Height="200"
+                MinWidth="240"
+                MinHeight="200"
+                Background="Transparent">
                 <Grid.RowDefinitions>
-                    <RowDefinition Height="32"></RowDefinition>
-                    <RowDefinition Height="auto"></RowDefinition>
-                    <RowDefinition Height="*"></RowDefinition>
-                    <RowDefinition Height="auto"></RowDefinition>
+                    <RowDefinition Height="32" />
+                    <RowDefinition Height="auto" />
+                    <RowDefinition Height="*" />
+                    <RowDefinition Height="auto" />
                 </Grid.RowDefinitions>
                 <Grid Margin="8,0,8,0">
                     <Grid.ColumnDefinitions>
-                        <ColumnDefinition Width="auto"></ColumnDefinition>
-                        <ColumnDefinition Width="auto"></ColumnDefinition>
-                        <ColumnDefinition Width="*"></ColumnDefinition>
-                        <ColumnDefinition Width="auto"></ColumnDefinition>
-                        <ColumnDefinition Width="auto"></ColumnDefinition>
+                        <ColumnDefinition Width="auto" />
+                        <ColumnDefinition Width="auto" />
+                        <ColumnDefinition Width="*" />
+                        <ColumnDefinition Width="auto" />
+                        <ColumnDefinition Width="auto" />
                     </Grid.ColumnDefinitions>
-                    <TextBlock x:Name="AuthorText" Grid.Column="1" FontFamily="SegoeUI" FontSize="12" VerticalAlignment="Center" LineHeight="16" Margin="2,2,0,0"/>
-                    <TextBlock Name="DateText" Grid.Column="3" Foreground="{StaticResource color.sys.text.neutral.lv2}" VerticalAlignment="Center"  Margin="0,-2,0,0" FontFamily="SegoeUI" FontSize="12" LineHeight="16"></TextBlock>
-                    <Border Grid.Column="4" Visibility="Collapsed" MouseUp="CloseText_MouseUp" Background="#01000000" Margin="0,-8,-3,0">
-                        <Path Fill="#000000" Width="16" Height="16" >
+                    <TextBlock
+                        x:Name="AuthorText"
+                        Grid.Column="1"
+                        Margin="2,2,0,0"
+                        VerticalAlignment="Center"
+                        FontFamily="SegoeUI"
+                        FontSize="12"
+                        LineHeight="16"
+                        Text="{Binding AuthorText}" />
+                    <TextBlock
+                        Name="DateText"
+                        Grid.Column="3"
+                        Margin="0,-2,0,0"
+                        VerticalAlignment="Center"
+                        FontFamily="SegoeUI"
+                        FontSize="12"
+                        Foreground="{StaticResource color.sys.text.neutral.lv2}"
+                        LineHeight="16"
+                        Text="{Binding DateText}" />
+                    <Border
+                        Grid.Column="4"
+                        Margin="0,-8,-3,0"
+                        Background="#01000000"
+                        MouseUp="CloseText_MouseUp"
+                        Visibility="Collapsed">
+                        <Path
+                            Width="16"
+                            Height="16"
+                            Fill="#000000">
                             <Path.Data>
                                 M9.48528137,2.98528137 L9.48428137,8.48428137 L14.9852814,8.48528137 L14.9852814,9.48528137 L9.48428137,9.48428137 L9.48528137,14.9852814 L8.48528137,14.9852814 L8.48428137,9.48428137 L2.98528137,9.48528137 L2.98528137,8.48528137 L8.48428137,8.48428137 L8.48528137,2.98528137 L9.48528137,2.98528137 Z
                             </Path.Data>
                             <Path.LayoutTransform>
-                                <RotateTransform Angle="45"></RotateTransform>
+                                <RotateTransform Angle="45" />
                             </Path.LayoutTransform>
                         </Path>
                     </Border>
                 </Grid>
-                <Rectangle Margin="8,0,8,0" VerticalAlignment="Bottom" Height="1" Fill="{StaticResource color.sys.layout.divider}"/>
-                <TextBox  x:Name="ContentText" Grid.Row="2" Padding="2,4,0,0"  Margin="4,0,4,0" Background="#CCFFFFFF" BorderThickness="0" 
-                     AcceptsReturn="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto"></TextBox>
+                <Rectangle
+                    Height="1"
+                    Margin="8,0,8,0"
+                    VerticalAlignment="Bottom"
+                    Fill="{StaticResource color.sys.layout.divider}" />
+                <TextBox
+                    x:Name="ContentText"
+                    Grid.Row="2"
+                    Margin="4,0,4,0"
+                    Padding="2,4,0,0"
+                    AcceptsReturn="True"
+                    Background="#CCFFFFFF"
+                    BorderThickness="0"
+                    Text="{Binding ContentText}"
+                    TextWrapping="Wrap"
+                    VerticalScrollBarVisibility="Auto" />
 
                 <Grid Grid.Row="3">
                     <ListBox
-            x:Name="ListColor"
-            Background="Transparent"
-            BorderThickness="0"
-            ItemContainerStyle="{StaticResource listboxItemStyle}"
-            ItemTemplate="{StaticResource listboxData}"
-            SelectionChanged="ListColor_SelectionChanged"
-            >
+                        x:Name="ListColor"
+                        Background="Transparent"
+                        BorderThickness="0"
+                        ItemContainerStyle="{StaticResource listboxItemStyle}"
+                        ItemTemplate="{StaticResource listboxData}"
+                        SelectionChanged="ListColor_SelectionChanged">
                         <ListBox.ItemsPanel>
                             <ItemsPanelTemplate>
                                 <WrapPanel Orientation="Horizontal" />
@@ -102,28 +167,34 @@
                     </ListBox>
                 </Grid>
 
-
                 <Button
-                        x:Name="BtnDelete" HorizontalAlignment="Right"
-                        Width="32" Grid.Row="3"
-                        Height="32"
-                        MaxHeight="40"
-                        Margin="16,0,10,5" BorderThickness="0"
-                        Foreground="#6B6F7D" Click="BtnDelete_Click"
-                        
-                        Style="{StaticResource btn.sec}">
+                    x:Name="BtnDelete"
+                    Grid.Row="3"
+                    Width="32"
+                    Height="32"
+                    MaxHeight="40"
+                    Margin="16,0,10,5"
+                    HorizontalAlignment="Right"
+                    BorderThickness="0"
+                    Click="BtnDelete_Click"
+                    Foreground="#6B6F7D"
+                    Style="{StaticResource btn.sec}">
                     <Path
-                            Width="32"
-                            Height="32"
-                            Data="M14 9.75H18V8.25H14V9.75ZM9 12.25H10.25V23C10.25 23.4142 10.5858 23.75 11 23.75H21C21.4142 23.75 21.75 23.4142 21.75 23V12.25H23V10.75H9V12.25ZM11.75 22.25V12.25H20.25V22.25H11.75ZM15.25 14.5V19.5H16.75V14.5H15.25Z"
-                            Fill="{Binding ElementName=BtnDelete, Path=Foreground}" />
+                        Width="32"
+                        Height="32"
+                        Data="M14 9.75H18V8.25H14V9.75ZM9 12.25H10.25V23C10.25 23.4142 10.5858 23.75 11 23.75H21C21.4142 23.75 21.75 23.4142 21.75 23V12.25H23V10.75H9V12.25ZM11.75 22.25V12.25H20.25V22.25H11.75ZM15.25 14.5V19.5H16.75V14.5H15.25Z"
+                        Fill="{Binding ElementName=BtnDelete, Path=Foreground}" />
                 </Button>
 
-
-                <ResizeGrip Name="GripControl" Visibility="Collapsed" Grid.Row="3" HorizontalAlignment="Right" Margin="0,2,0,0" Cursor="SizeNWSE" MouseMove="ResizeGrip_MouseMove"></ResizeGrip>
+                <ResizeGrip
+                    Name="GripControl"
+                    Grid.Row="3"
+                    Margin="0,2,0,0"
+                    HorizontalAlignment="Right"
+                    Cursor="SizeNWSE"
+                    MouseMove="ResizeGrip_MouseMove"
+                    Visibility="Collapsed" />
             </Grid>
-
         </Border>
-       
     </Grid>
-</annotview:StickyPopupExt>
+</annotview:StickyPopupExt>

+ 18 - 13
PDF Office/Views/PropertyPanel/AnnotPanel/StickyNotePopup.xaml.cs

@@ -2,6 +2,7 @@
 using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
 using PDF_Office.CustomControl.CompositeControl;
+using PDF_Office.ViewModels.PropertyPanel.AnnotPanel;
 using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
@@ -24,17 +25,19 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
     /// <summary>
     /// StickyNotePopup.xaml 的交互逻辑
     /// </summary>
-   
+
     public class GripThumb : Thumb
     {
         private Pen DrawPen;
         private Brush FillBrush;
+
         public GripThumb()
         {
             DefaultStyleKey = typeof(GripThumb);
             DrawPen = new Pen(new SolidColorBrush(Colors.Blue), 2);
             FillBrush = new SolidColorBrush(Color.FromArgb(0x0A, 0xFF, 0xFF, 0xFF));
         }
+
         protected override void OnRender(DrawingContext DrawContext)
         {
             DrawContext.DrawRectangle(FillBrush, null, new Rect(0, 0, Width, Height));
@@ -43,6 +46,7 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
             DrawContext.DrawLine(DrawPen, new Point(Width, Height * 2 / 3), new Point(Width * 2 / 3, Height));
         }
     }
+
     /// <summary>
     /// StickyNotePopup.xaml 的交互逻辑
     /// </summary>
@@ -53,6 +57,7 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
         public Point OffsetParent;
 
         private byte saveOpacity = 1;
+
         public StickyNotePopup()
         {
             InitializeComponent();
@@ -82,7 +87,6 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
             var ui = Mouse.DirectlyOver as FrameworkElement;
             if (ui != null)
             {
-
                 var colorItem = ui.DataContext as ColorItem;
                 if (colorItem != null)
                 {
@@ -90,7 +94,7 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
                     return;
                 }
             }
-
+            (DataContext as StickyNotePopupViewModel).ContentTextLostFocus.Execute();
             CloseText_MouseUp(this, null);
         }
 
@@ -132,7 +136,6 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
                             return;
                         }
                     }
-
                 }
 
                 ListColor.SelectedItem = null;
@@ -162,7 +165,6 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
             }
         }
 
-
         public string StickyAuthor
         {
             get
@@ -190,6 +192,7 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
         public StickyAnnotArgs GetCurrentAnnot { get; set; }
         public CPDFViewer GetPDFViewer { get; set; }
         public bool CanMove { get; set; } = true;
+
         private void ResizeGrip_MouseMove(object sender, MouseEventArgs e)
         {
             e.Handled = true;
@@ -217,7 +220,6 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
             }
         }
 
-
         private void CloseText_MouseUp(object sender, MouseButtonEventArgs e)
         {
             if (e != null)
@@ -267,12 +269,13 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
             PressPoint = new Point(0, 0);
             GripControl.ReleaseMouseCapture();
         }
+
         protected override void OnMouseMove(MouseEventArgs e)
         {
             e.Handled = true;
             if (e.LeftButton == MouseButtonState.Pressed && e.Source.GetType() != typeof(TextBox) && e.Source.GetType() != typeof(GripThumb))
             {
-                if (CanMove == false || (PressPoint.X == 0 && PressPoint.Y == 0))
+                if (CanMove == false || (PressPoint.X == 0 && PressPoint.Y == 0) || ContainerElement == null)
                 {
                     return;
                 }
@@ -343,7 +346,6 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
             return StickyText;
         }
 
-
         private void ListColor_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
             var colorItem = ListColor.SelectedItem as ColorItem;
@@ -375,18 +377,21 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
                 // Closed.Invoke(sender, EventArgs.Empty);
                 CloseText_MouseUp(this, null);
             }
-
         }
 
         private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         {
-          var frame = e.OriginalSource as Control;
-            if(frame != null)
+            var frame = e.OriginalSource as Control;
+            if (frame != null)
             {
                 var color = frame.Background as SolidColorBrush;
-                if(color != null && color.Color == Colors.Transparent)
+                if (color != null && color.Color == Colors.Transparent)
                     Closed.Invoke(sender, EventArgs.Empty);
             }
         }
+
+        private void StickyPopupExt_LostFocus(object sender, RoutedEventArgs e)
+        {
+        }
     }
-}
+}

+ 13 - 2
PDF Office/Views/ViewContent.xaml

@@ -16,16 +16,19 @@
     d:DesignWidth="800"
     prism:ViewModelLocator.AutoWireViewModel="True"
     AllowDrop="True"
-    KeyDown="UserControl_KeyDown"
     DragEnter="UserControl_DragEnter"
-    DragOver="UserControl_DragOver"
     DragLeave="UserControl_DragLeave"
+    DragOver="UserControl_DragOver"
     Drop="UserControl_Drop"
+    KeyDown="UserControl_KeyDown"
     mc:Ignorable="d">
     <i:Interaction.Triggers>
         <i:EventTrigger EventName="Loaded">
             <prism:InvokeCommandAction Command="{Binding Load}" />
         </i:EventTrigger>
+        <i:EventTrigger EventName="PreviewMouseDown">
+            <prism:InvokeCommandAction Command="{Binding MouseDown}" />
+        </i:EventTrigger>
     </i:Interaction.Triggers>
     <UserControl.Resources>
         <ResourceDictionary>
@@ -479,6 +482,14 @@
                 VerticalAlignment="Top"
                 prism:RegionManager.RegionName="{Binding LeftTipContentRegionName}"
                 Visibility="{Binding LeftTipVisible}" />
+            <!--  便签弹窗  -->
+            <Canvas x:Name="CanvasNote" Grid.Column="2">
+                <ContentControl
+                    Canvas.Left="{Binding CanvasNoteLeft}"
+                    Canvas.Bottom="{Binding CanvasNoteTop}"
+                    prism:RegionManager.RegionName="{Binding NotePopupRegionName}"
+                    Visibility="{Binding NotePopupVisible}" />
+            </Canvas>
         </Grid>
 
         <!--  用于显示页面编辑、水印、背景、标记密文等功能的区域  -->