|
@@ -24,6 +24,7 @@ using System.Windows.Controls.Primitives;
|
|
|
using System.Windows.Media;
|
|
|
using System.Diagnostics;
|
|
|
using PDF_Office.Model.AnnotPanel;
|
|
|
+using System.Windows.Input;
|
|
|
|
|
|
namespace PDF_Office.ViewModels.Tools
|
|
|
{
|
|
@@ -726,9 +727,72 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
Pen hoverPen = new Pen(new SolidColorBrush(Color.FromArgb(0xff, 0x11, 0x8A, 0xff)), 1);
|
|
|
hoverPen.DashStyle = DashStyles.Dash;
|
|
|
e.DrawContext?.DrawRectangle(null, hoverPen, hoverRect);
|
|
|
+
|
|
|
+ //Todo:目前ComPDFKit.Viewer没有e.Annot参数
|
|
|
+ //便签,显示ToolTip内容
|
|
|
+ //if (e.Annot != null && e.Annot.Type == C_ANNOTATION_TYPE.C_ANNOTATION_TEXT)
|
|
|
+ //{
|
|
|
+ // if (PDFViewer.ToolTip == null)
|
|
|
+ // {
|
|
|
+ // var content = e.Annot.GetContent();
|
|
|
+ // if (string.IsNullOrEmpty(content) == false)
|
|
|
+ // {
|
|
|
+ // ToolTip TipChild = new ToolTip();
|
|
|
+ // TipChild.Style = App.Current.Resources["FlowToolTip"] as Style;
|
|
|
+ // TipChild.MaxWidth = 246;
|
|
|
+ // TipChild.Content = content;
|
|
|
+ // TipChild.Visibility = Visibility.Visible;
|
|
|
+ // TipChild.IsOpen = true;
|
|
|
+ // TipChild.Placement = PlacementMode.Right;
|
|
|
+ // var rec = e.Annot.GetRect();
|
|
|
+ // TipChild.PlacementRectangle = new Rect(rec.left, rec.top, rec.right, rec.bottom);
|
|
|
+ // TipChild.PlacementTarget = PDFViewer.Parent as ContentControl;
|
|
|
+ // TipChild.Placement = PlacementMode.MousePoint;
|
|
|
+ // PDFViewer.ToolTip = TipChild;
|
|
|
+ // oldRect = hoverRect;
|
|
|
+ // PDFViewer.MouseMove -= PDFViewer_MouseMove;
|
|
|
+ // PDFViewer.MouseMove += PDFViewer_MouseMove;
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // }
|
|
|
+
|
|
|
+ //}
|
|
|
+ }
|
|
|
+
|
|
|
+ CloseAnnotToolTip();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Rect oldRect = new Rect(0, 0, 0, 0);
|
|
|
+ private void CloseAnnotToolTip()
|
|
|
+ {
|
|
|
+ if (PDFViewer.ToolTip != null && PDFViewer.ToolTip is ToolTip)
|
|
|
+ {
|
|
|
+ ToolTip oldTips = (ToolTip)PDFViewer.ToolTip;
|
|
|
+ oldTips.IsOpen = false;
|
|
|
+ oldTips.Visibility = Visibility.Collapsed;
|
|
|
+ PDFViewer.ToolTip = null;
|
|
|
+ PDFViewer.MouseMove -= PDFViewer_MouseMove;
|
|
|
+ oldRect = new Rect(0, 0, 0, 0);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void PDFViewer_MouseMove(object sender, MouseEventArgs e)
|
|
|
+ {
|
|
|
+ if (sender != null && PDFViewer.ToolTip != null && PDFViewer.Parent != null)
|
|
|
+ {
|
|
|
+ var newPoint = e.GetPosition(PDFViewer.Parent as ContentControl);
|
|
|
+ var isOutw = newPoint.X > (oldRect.X + oldRect.Width + 4);
|
|
|
+ var isOuth = newPoint.Y > (oldRect.Y + oldRect.Height + 4);
|
|
|
+ if (newPoint.X < oldRect.X || newPoint.Y < oldRect.Y || isOutw || isOuth)
|
|
|
+ {
|
|
|
+ CloseAnnotToolTip();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
#endregion PDFViewer事件
|
|
|
|
|
|
#region BindingEvent事件
|