|
@@ -1,4 +1,6 @@
|
|
|
using ComPDFKitViewer;
|
|
|
+using ComPDFKitViewer.AnnotEvent;
|
|
|
+using ComPDFKitViewer.PdfViewer;
|
|
|
using PDF_Office.CustomControl.CompositeControl;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
@@ -73,6 +75,22 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
|
|
|
Color bkColor = (border.BorderBrush as SolidColorBrush).Color;
|
|
|
bkColor.A = saveOpacity;
|
|
|
border.BorderBrush = new SolidColorBrush(bkColor);
|
|
|
+ this.Background = new SolidColorBrush(Colors.Transparent);
|
|
|
+ this.BorderBrush = new SolidColorBrush(Colors.Transparent);
|
|
|
+
|
|
|
+ //为了点击某控件之后就直接关闭窗口
|
|
|
+ var ui = Mouse.DirectlyOver as FrameworkElement;
|
|
|
+ if (ui != null)
|
|
|
+ {
|
|
|
+
|
|
|
+ var colorItem = ui.DataContext as ColorItem;
|
|
|
+ if (colorItem != null)
|
|
|
+ {
|
|
|
+ e.Handled = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
CloseText_MouseUp(this, null);
|
|
|
}
|
|
|
|
|
@@ -82,13 +100,43 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
|
|
|
saveOpacity = bkColor.A;
|
|
|
bkColor.A = 255;
|
|
|
border.BorderBrush = new SolidColorBrush(bkColor);
|
|
|
- this.Background = new SolidColorBrush(this.StickyColor);
|
|
|
+ this.Background = new SolidColorBrush(Colors.Transparent);
|
|
|
+ this.BorderBrush = new SolidColorBrush(Colors.Transparent);
|
|
|
}
|
|
|
|
|
|
private void StickyPopupControl_Loaded(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
ContentText.Focus();
|
|
|
ContentText.CaretIndex = ContentText.Text.Length;
|
|
|
+ LoadedColor();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void LoadedColor()
|
|
|
+ {
|
|
|
+ if (colors != null && colors.Count > 0)
|
|
|
+ {
|
|
|
+ BtnDelete.DataContext = colors[0];//为了避免点击删除按钮之后,先执行取消焦点函数后,就没法执行点击事件
|
|
|
+
|
|
|
+ if (GetCurrentAnnot != null)
|
|
|
+ {
|
|
|
+ foreach (var item in colors)
|
|
|
+ {
|
|
|
+ var colorItem = (item.Color as SolidColorBrush).Color;
|
|
|
+ if (colorItem.A == GetCurrentAnnot.Color.A &&
|
|
|
+ colorItem.R == GetCurrentAnnot.Color.R &&
|
|
|
+ colorItem.G == GetCurrentAnnot.Color.G &&
|
|
|
+ colorItem.B == GetCurrentAnnot.Color.B
|
|
|
+ )
|
|
|
+ {
|
|
|
+ ListColor.SelectedItem = item;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ ListColor.SelectedItem = null;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void StickyPopupControl_MouseDown(object sender, MouseButtonEventArgs e)
|
|
@@ -139,6 +187,8 @@ 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)
|
|
|
{
|
|
@@ -272,6 +322,8 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
|
|
|
{
|
|
|
base.SetStickyColor(newColor);
|
|
|
border.BorderBrush = new SolidColorBrush(newColor);
|
|
|
+ this.Background = new SolidColorBrush(Colors.Transparent);
|
|
|
+ this.BorderBrush = new SolidColorBrush(Colors.Transparent);
|
|
|
}
|
|
|
|
|
|
public override void SetStickyNote(string note)
|
|
@@ -291,22 +343,39 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
|
|
|
return StickyText;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private void ListColor_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
{
|
|
|
- var color = ListColor.SelectedItem as ColorItem;
|
|
|
- if (color != null)
|
|
|
+ var colorItem = ListColor.SelectedItem as ColorItem;
|
|
|
+ if (colorItem != null)
|
|
|
{
|
|
|
- this.SetStickyColor((color.Color as SolidColorBrush).Color);
|
|
|
- border.BorderBrush = new SolidColorBrush((color.Color as SolidColorBrush).Color);
|
|
|
- this.Background = new SolidColorBrush((color.Color as SolidColorBrush).Color);
|
|
|
+ var color = (colorItem.Color as SolidColorBrush).Color;
|
|
|
+ this.SetStickyColor(color);
|
|
|
+ var annot = GetCurrentAnnot as StickyAnnotArgs;
|
|
|
+ if (annot != null)
|
|
|
+ {
|
|
|
+ annot.Color = color;
|
|
|
+ var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
|
|
|
+ AnnotEvent?.UpdateAttrib(AnnotAttrib.Color, color);
|
|
|
+ AnnotEvent?.UpdateAnnot();
|
|
|
+ }
|
|
|
+ border.BorderBrush = new SolidColorBrush(color);
|
|
|
+ this.Background = new SolidColorBrush(Colors.Transparent);
|
|
|
+ this.BorderBrush = new SolidColorBrush(Colors.Transparent);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void BtnDelete_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
- ContentText.Text = "";
|
|
|
- this.SetStickyNote("");
|
|
|
- Closed.Invoke(sender, EventArgs.Empty);
|
|
|
+ if (GetPDFViewer != null)
|
|
|
+ {
|
|
|
+ if (GetCurrentAnnot != null)
|
|
|
+ GetPDFViewer.RemovePageAnnot(GetCurrentAnnot.PageIndex, GetCurrentAnnot.AnnotIndex);
|
|
|
+
|
|
|
+ // Closed.Invoke(sender, EventArgs.Empty);
|
|
|
+ CloseText_MouseUp(this, null);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|