AnnotToolContentViewModel.Command.cs 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173
  1. using ComPDFKit.PDFAnnotation;
  2. using ComPDFKit.PDFDocument.Action;
  3. using ComPDFKit.PDFDocument;
  4. using ComPDFKitViewer;
  5. using ComPDFKitViewer.AnnotEvent;
  6. using ComPDFKitViewer.PdfViewer;
  7. using PDF_Office.CustomControl;
  8. using PDF_Office.EventAggregators;
  9. using PDF_Office.Helper;
  10. using PDF_Office.Properties;
  11. using PDF_Office.ViewModels.BOTA;
  12. using PDF_Office.Views.BOTA;
  13. using PDFSettings;
  14. using Prism.Mvvm;
  15. using Prism.Regions;
  16. using System;
  17. using System.Collections.Generic;
  18. using System.Linq;
  19. using System.Text;
  20. using System.Threading.Tasks;
  21. using System.Windows;
  22. using System.Windows.Controls;
  23. using System.Windows.Controls.Primitives;
  24. using System.Windows.Media;
  25. using System.Diagnostics;
  26. using PDF_Office.Model.AnnotPanel;
  27. using System.Windows.Input;
  28. using PDF_Office.ViewModels.Tools.AnnotManager;
  29. using ComPDFKit.Import;
  30. namespace PDF_Office.ViewModels.Tools
  31. {
  32. public sealed partial class AnnotToolContentViewModel : BindableBase, INavigationAware
  33. {
  34. #region 事件绑定和解绑
  35. private void BindingEvent()
  36. {
  37. //属性面板与注释工具栏绑定:属性面板的属性变化,会同步注释工具栏的属性值
  38. //比如在属性面板里更改注释颜色,会同时更新工具栏对应的工具颜色
  39. propertyPanel.DataChanged -= AnnotPropertyPanel_DataChanged;
  40. propertyPanel.DataChanged += AnnotPropertyPanel_DataChanged;
  41. propertyPanel.AnnotTypeChanged -= AnnotPropertyPanel_AnnotTypeChanged;
  42. propertyPanel.AnnotTypeChanged += AnnotPropertyPanel_AnnotTypeChanged;
  43. //快捷键
  44. KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
  45. KeyEventsHelper.KeyDown += ShortCut_KeyDown;
  46. }
  47. private void UnBindingEvent()
  48. {
  49. propertyPanel.DataChanged -= AnnotPropertyPanel_DataChanged;
  50. propertyPanel.AnnotTypeChanged -= AnnotPropertyPanel_AnnotTypeChanged;
  51. //快捷盘解绑
  52. KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
  53. }
  54. private void BindingPDFViewerHandler()
  55. {
  56. //来自PDFViewer的响应事件
  57. if (PDFViewer != null)
  58. {
  59. PDFViewer.AnnotEditHandler -= PDFViewer_AnnotEditHandler;
  60. PDFViewer.AnnotEditHandler += PDFViewer_AnnotEditHandler;
  61. PDFViewer.AnnotActiveHandler -= PDFViewer_AnnotActiveHandler;
  62. PDFViewer.AnnotActiveHandler += PDFViewer_AnnotActiveHandler;
  63. PDFViewer.AnnotCommandHandler -= PDFViewer_AnnotCommandHandler;
  64. PDFViewer.AnnotCommandHandler += PDFViewer_AnnotCommandHandler;
  65. PDFViewer.SnapshotCommandHandler -= PDFViewer_SnapshotCommandHandler;
  66. PDFViewer.SnapshotCommandHandler += PDFViewer_SnapshotCommandHandler;
  67. PDFViewer.PDFActionHandler -= PDFViewer_PDFActionHandler;
  68. PDFViewer.PDFActionHandler += PDFViewer_PDFActionHandler;
  69. PDFViewer.AnnotHoverHandler -= PDFViewer_AnnotHoverHandler;
  70. PDFViewer.AnnotHoverHandler += PDFViewer_AnnotHoverHandler;
  71. PDFViewer.PreviewMouseLeftButtonDown -= PDFViewer_PreviewMouseLeftButtonDown;
  72. PDFViewer.PreviewMouseLeftButtonDown += PDFViewer_PreviewMouseLeftButtonDown;
  73. }
  74. }
  75. private void UnBindingPDFViewerHandler()
  76. {
  77. if (PDFViewer != null)
  78. {
  79. PDFViewer.AnnotEditHandler -= PDFViewer_AnnotEditHandler;
  80. PDFViewer.AnnotActiveHandler -= PDFViewer_AnnotActiveHandler;
  81. PDFViewer.AnnotCommandHandler -= PDFViewer_AnnotCommandHandler;
  82. PDFViewer.SnapshotCommandHandler -= PDFViewer_SnapshotCommandHandler;
  83. PDFViewer.PDFActionHandler -= PDFViewer_PDFActionHandler;
  84. PDFViewer.AnnotHoverHandler -= PDFViewer_AnnotHoverHandler;
  85. PDFViewer.PreviewMouseLeftButtonDown -= PDFViewer_PreviewMouseLeftButtonDown;
  86. }
  87. }
  88. #endregion 事件绑定和解绑
  89. #region 与触发事件调用相关的函数
  90. //鼠标左键双击注释
  91. private void PDFViewer_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  92. {
  93. if (e.ClickCount == 2)
  94. {
  95. if (CurrentSelectedAnnot != null)
  96. {
  97. var type = CurrentSelectedAnnot.EventType;
  98. if (type != AnnotArgsType.AnnotSticky && type != AnnotArgsType.AnnotFreeText &&
  99. type != AnnotArgsType.AnnotHighlight && type != AnnotArgsType.AnnotUnderline && type != AnnotArgsType.AnnotStrikeout)
  100. {
  101. var rect = CurrentSelectedAnnot.ClientRect;
  102. var ui = PDFViewer.Parent as ContentControl;
  103. if (ui != null)
  104. {
  105. var point = e.GetPosition(ui);
  106. if (rect.Left < point.X && rect.Top < point.Y && (rect.Width + rect.X) >= point.X && (rect.Height + rect.Y) >= point.Y)
  107. {
  108. PopAnnotNoteText(CurrentSelectedAnnot);
  109. }
  110. }
  111. }
  112. }
  113. }
  114. }
  115. //超链接跳转
  116. private void PDFViewer_PDFActionHandler(object sender, ComPDFKit.PDFDocument.Action.CPDFAction action)
  117. {
  118. if (action == null)
  119. {
  120. return;
  121. }
  122. switch (action.ActionType)
  123. {
  124. case C_ACTION_TYPE.ACTION_TYPE_GOTO:
  125. if (PDFViewer != null)
  126. {
  127. CPDFGoToAction gotoAction = action as CPDFGoToAction;
  128. CPDFDestination dest = gotoAction.GetDestination(PDFViewer.Document);
  129. if (dest != null)
  130. {
  131. PDFViewer.GoToPage(dest.PageIndex, new System.Windows.Point(0, 0));
  132. }
  133. }
  134. break;
  135. case C_ACTION_TYPE.ACTION_TYPE_URI:
  136. {
  137. CPDFUriAction uriAction = action as CPDFUriAction;
  138. string uri = uriAction.GetUri();
  139. try
  140. {
  141. if (!string.IsNullOrEmpty(uri))
  142. {
  143. Process.Start(uri);
  144. }
  145. }
  146. catch (Exception ex)
  147. {
  148. }
  149. }
  150. break;
  151. }
  152. }
  153. private void GetSelectedAnnots(AnnotAttribEvent e)
  154. {
  155. var annot = e.AnnotItemsList[0];
  156. switch (annot.EventType)
  157. {
  158. case AnnotArgsType.AnnotHighlight:
  159. GetHighLight(e.AnnotItemsList);
  160. break;
  161. case AnnotArgsType.AnnotUnderline:
  162. GetUnderLine(e.AnnotItemsList);
  163. break;
  164. case AnnotArgsType.AnnotStrikeout:
  165. GetStrikeout(e.AnnotItemsList);
  166. break;
  167. case AnnotArgsType.AnnotSquiggly:
  168. GetSquiggly(e.AnnotItemsList);
  169. break;
  170. case AnnotArgsType.AnnotFreehand:
  171. GetFreehand(e.AnnotItemsList);
  172. break;
  173. case AnnotArgsType.AnnotFreeText:
  174. GetFreetext(e.AnnotItemsList);
  175. break;
  176. case AnnotArgsType.AnnotSquare:
  177. GetRect(e.AnnotItemsList);
  178. break;
  179. case AnnotArgsType.AnnotCircle:
  180. GetCircle(e.AnnotItemsList);
  181. break;
  182. case AnnotArgsType.AnnotLine:
  183. bool isLine = true;
  184. if (e.Attribs.ContainsKey(AnnotAttrib.LineStart))
  185. {
  186. if ((C_LINE_TYPE)e.Attribs[AnnotAttrib.LineStart] != C_LINE_TYPE.LINETYPE_UNKNOWN && (C_LINE_TYPE)e.Attribs[AnnotAttrib.LineStart] != C_LINE_TYPE.LINETYPE_NONE)
  187. {
  188. isLine = false;
  189. }
  190. }
  191. if (e.Attribs.ContainsKey(AnnotAttrib.LineEnd))
  192. {
  193. if ((C_LINE_TYPE)e.Attribs[AnnotAttrib.LineEnd] != C_LINE_TYPE.LINETYPE_UNKNOWN && (C_LINE_TYPE)e.Attribs[AnnotAttrib.LineEnd] != C_LINE_TYPE.LINETYPE_NONE)
  194. {
  195. isLine = false;
  196. }
  197. }
  198. if (isLine)
  199. GetArrowLine("Line", e.AnnotItemsList);
  200. else
  201. GetArrowLine("Arrow", e.AnnotItemsList);
  202. break;
  203. case AnnotArgsType.AnnotLink:
  204. //viewContentViewModel.IsCreateLink = false;
  205. //e.IsAnnotCreateReset= true;
  206. if (btnLinkIsChecked == false)
  207. {
  208. propertyPanel.IsAddLink = false;
  209. }
  210. GetLink(e.AnnotItemsList, e);
  211. break;
  212. case AnnotArgsType.AnnotSticky:
  213. GetStickyNote(e.AnnotItemsList);
  214. customStickyPopup.GetCurrentAnnot = e.AnnotItemsList[0] as StickyAnnotArgs;
  215. customStickyPopup.GetPDFViewer = PDFViewer;
  216. break;
  217. case AnnotArgsType.AnnotStamp:
  218. GetStamp();
  219. break;
  220. }
  221. }
  222. private void SelectedSignature(List<AnnotHandlerEventArgs> annotlist)
  223. {
  224. if (annotlist == null || annotlist.Count == 0)
  225. return;
  226. var annot = annotlist[0];
  227. if (annot.EventType != AnnotArgsType.AnnotStamp && annot.EventType != AnnotArgsType.AnnotFreehand)
  228. return;
  229. if (annot.PageIndex < 0 || annot.AnnotIndex < 0)
  230. return;
  231. var signAnnot = viewContentViewModel.AnnotSignatures.FirstOrDefault(temp => temp.Item1 == annot.PageIndex && temp.Item2 == annot.AnnotIndex);
  232. if (signAnnot == null)
  233. {
  234. if (annot.EventType == AnnotArgsType.AnnotStamp)
  235. {
  236. StrAnnotToolChecked = "Stamp";
  237. }
  238. else
  239. {
  240. StrAnnotToolChecked = "";
  241. }
  242. }
  243. else
  244. {
  245. GetSignature();
  246. StrAnnotToolChecked = "Signature";
  247. }
  248. }
  249. private void AddAnnotSignature(AnnotHandlerEventArgs annot)
  250. {
  251. if ((annot.EventType != AnnotArgsType.AnnotStamp && annot.EventType != AnnotArgsType.AnnotFreehand) ||
  252. (annot.PageIndex < 0 || annot.AnnotIndex < 0)) return;
  253. if (StrAnnotToolChecked == "Signature")
  254. {
  255. if (viewContentViewModel.AnnotSignatures == null)
  256. viewContentViewModel.AnnotSignatures = new List<Tuple<int, int>>();
  257. var signAnnot = viewContentViewModel.AnnotSignatures.FirstOrDefault(temp => temp.Item1 == annot.PageIndex && temp.Item2 == annot.AnnotIndex);
  258. if (signAnnot == null)
  259. {
  260. viewContentViewModel.AnnotSignatures.Add(new Tuple<int, int>(annot.PageIndex, annot.AnnotIndex));
  261. }
  262. }
  263. }
  264. #endregion 与触发事件调用相关的函数
  265. #region PDFViewer事件
  266. private AnnotHandlerEventArgs CurrentSelectedAnnot = null;
  267. //选中和非选中注释
  268. private void PDFViewer_AnnotActiveHandler(object sender, AnnotAttribEvent e)
  269. {
  270. if (e != null)
  271. {
  272. var annot = e.AnnotItemsList[0];
  273. if (annot != null)
  274. {
  275. if (e.AnnotItemsList.Count == 1)
  276. {
  277. //IsAnnotCreateReset:是否为创建注释的状态
  278. if (e.IsAnnotCreateReset == false)
  279. {
  280. GetSelectedAnnots(e);
  281. SelectedSignature(e.AnnotItemsList);
  282. CurrentSelectedAnnot = annot;
  283. if (Settings.Default.AppProperties.InitialVIew.AutoExpandProperty)
  284. ShowPropertyPanel(true);
  285. }
  286. else
  287. {
  288. switch (annot.EventType)
  289. {
  290. case AnnotArgsType.AnnotLink:
  291. //viewContentViewModel.IsCreateLink = false;
  292. GetLink(e.AnnotItemsList, e);
  293. PDFViewer.SetToolParam(annot);
  294. break;
  295. }
  296. //TODO: 修改注释后,会作用到之后添加的注释中。因此先把此逻辑“创建注释后,会自动回到默认值”注释掉
  297. //注释代码原因:设计已经重新调整逻辑:所有注释创建后,编辑属性,所有属性会作用于下次创建的注释中。
  298. //if (annot.EventType != AnnotArgsType.AnnotStrikeout &&
  299. //annot.EventType != AnnotArgsType.AnnotUnderline &&
  300. //annot.EventType != AnnotArgsType.AnnotHighlight &&
  301. //annot.EventType != AnnotArgsType.AnnotSquiggly &&
  302. //annot.EventType != AnnotArgsType.AnnotLink &&
  303. //annot.EventType != AnnotArgsType.AnnotFreehand &&
  304. //annot.EventType != AnnotArgsType.AnnotSticky &&
  305. //)
  306. //{
  307. // if (ToolExpandDict.ContainsValue(e.AnnotItemsList[0].EventType))
  308. // {
  309. // var strLineAnnotTag = "";
  310. // if (e.AnnotItemsList[0] is LineAnnotArgs)
  311. // {
  312. // var lineAnnot = e.AnnotItemsList[0] as LineAnnotArgs;
  313. // if (lineAnnot.HeadLineType == C_LINE_TYPE.LINETYPE_NONE && lineAnnot.TailLineType == C_LINE_TYPE.LINETYPE_NONE)
  314. // {
  315. // strLineAnnotTag = "Line";
  316. // }
  317. // else
  318. // {
  319. // strLineAnnotTag = "Arrow";
  320. // }
  321. // }
  322. // foreach (var item in ToolExpandDict)
  323. // {
  324. // if (item.Value == e.AnnotItemsList[0].EventType)
  325. // {
  326. // annot = null;//新建注释时,回到默认值
  327. // if (string.IsNullOrEmpty(strLineAnnotTag))
  328. // {
  329. // FindAnnotTypeKey(item.Key, ref annot);
  330. // break;
  331. // }
  332. // else
  333. // {
  334. // if (strLineAnnotTag == item.Key)
  335. // {
  336. // FindAnnotTypeKey(item.Key, ref annot);
  337. // break;
  338. // }
  339. // }
  340. // }
  341. // }
  342. // PDFViewer.SetToolParam(annot);
  343. // }
  344. //}
  345. #region TO DO
  346. //设计重新调整,阅读页空白处,右键菜单,添加链接需要显示,其他和pro mac一样的效果,不显示属性栏
  347. //if (isRightMenuAddAnnot && annot.EventType!=AnnotArgsType.AnnotLink)
  348. //{
  349. // ShowPropertyPanel(false);
  350. //}
  351. //else
  352. //{
  353. // ShowPropertyPanel();
  354. //}
  355. #endregion TO DO
  356. }
  357. }
  358. else
  359. {
  360. bool isDifferentAnnotTyle = AnnotTransfer.IsDifferentTypeAnnots(e.AnnotItemsList);
  361. if (isDifferentAnnotTyle)
  362. viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
  363. else
  364. GetSelectedAnnots(e);
  365. }
  366. }
  367. //注释列表同步选中
  368. var list = e.GetPageAnnotsIndex();
  369. bool isTabItemAnnotation = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemAnnotation");
  370. if (viewContentViewModel.OpenBOTA == true && isTabItemAnnotation == true && bOTAContent.TabItemAnnotation.IsSelected == true && list != null && list.Count > 0)
  371. {
  372. if (list.Keys.Count == 0)
  373. {
  374. return;
  375. }
  376. var pageindex = new List<int>(list.Keys);
  377. List<int> annotes = new List<int>();
  378. list.TryGetValue(pageindex[0], out annotes);
  379. int annoteindex = annotes[0];
  380. AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
  381. if (viewModel != null)
  382. {
  383. viewModel.ScrollToAnnot(pageindex[0], annoteindex, annotation.AnnotationList);
  384. }
  385. }
  386. }
  387. else
  388. {
  389. if (BtnLinkIsChecked == false)
  390. {
  391. if (PDFViewer.MouseMode != MouseModes.AnnotCreate)
  392. {
  393. if (PDFViewer.MouseMode == MouseModes.PanTool && propertyPanel.IsAddLink == false && propertyPanel.IsLocationLink == false)
  394. {
  395. viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
  396. }
  397. }
  398. }
  399. }
  400. }
  401. //在注释工具的状态下,右键菜单
  402. private void PDFViewer_AnnotCommandHandler(object sender, AnnotCommandArgs e)
  403. {
  404. if (e.AnnotEventArgsList == null || (PDFViewer != null && PDFViewer.MouseMode == MouseModes.FormEditTool))
  405. return;
  406. switch (e.CommandType)
  407. {
  408. case CommandType.Context:
  409. if (e.AnnotEventArgsList.Count > 0)
  410. {
  411. if (App.mainWindowViewModel.SelectedItem.IsInReadctonMode && e.AnnotEventArgsList[0].EventType == AnnotArgsType.AnnotRedaction)
  412. {
  413. //绑定标记密文处右键菜单
  414. events.GetEvent<RedactionCommandEvent>().Publish(new RedactionCommandEventArgs() { UniCode = App.mainWindowViewModel.SelectedItem.Unicode, Sender = sender, args = e });
  415. }
  416. else
  417. {
  418. if (e.AnnotEventArgsList.Count == 1)
  419. {
  420. var selectedAnnot = e.AnnotEventArgsList[0];
  421. PopMenuCheckedLineDash(selectedAnnot);
  422. PopMenuCheckedFontFamily(selectedAnnot);
  423. PopMenuCheckedTextAglin(selectedAnnot);
  424. switch (selectedAnnot.EventType)
  425. {
  426. case AnnotArgsType.AnnotHighlight:
  427. case AnnotArgsType.AnnotUnderline:
  428. case AnnotArgsType.AnnotStrikeout:
  429. case AnnotArgsType.AnnotSquiggly:
  430. if (selectedAnnot.EventType == AnnotArgsType.AnnotHighlight)
  431. {
  432. colorContent.ItemSource = AnnotColorList.GetColorList(ColorSelectorType.Highlight);
  433. }
  434. else
  435. {
  436. colorContent.ItemSource = AnnotColorList.GetColorList(ColorSelectorType.Border);
  437. }
  438. e.PopupMenu = HightAnnotPopMenu.OpenMenu(selectedAnnot, sender);
  439. break;
  440. case AnnotArgsType.AnnotFreehand:
  441. e.PopupMenu = FreeHandAnnotPopMenu.OpenMenu(selectedAnnot, sender);
  442. break;
  443. case AnnotArgsType.AnnotFreeText:
  444. e.PopupMenu = FreeTextAnnotPopMenu.OpenMenu(selectedAnnot, sender);
  445. break;
  446. case AnnotArgsType.AnnotSticky:
  447. e.PopupMenu = StrickNoteAnnotPopMenu.OpenMenu(selectedAnnot, sender);
  448. break;
  449. case AnnotArgsType.AnnotSquare:
  450. case AnnotArgsType.AnnotCircle:
  451. ShapeAnnotPopMenu.SetVisual("ShapeDirect", false);
  452. ShapeAnnotPopMenu.SetVisual("ShapeFillColor", true);
  453. e.PopupMenu = ShapeAnnotPopMenu.OpenMenu(selectedAnnot, sender);
  454. break;
  455. case AnnotArgsType.AnnotLine:
  456. ShapeAnnotPopMenu.SetVisual("ShapeFillColor", false);
  457. ShapeAnnotPopMenu.SetVisual("ShapeDirect", true);
  458. e.PopupMenu = ShapeAnnotPopMenu.OpenMenu(selectedAnnot, sender);
  459. break;
  460. case AnnotArgsType.AnnotLink:
  461. e.PopupMenu = LinkAnnotPopMenu.OpenMenu(selectedAnnot, sender);
  462. break;
  463. case AnnotArgsType.AnnotStamp:
  464. e.PopupMenu = StampAnnotPopMenu.OpenMenu(selectedAnnot, sender);
  465. break;
  466. }
  467. }
  468. else
  469. {
  470. bool isHigh = true;//是否为高亮
  471. foreach (var item in e.AnnotEventArgsList)
  472. {
  473. if (AnnotTransfer.IsHightAnnot(item) == false)
  474. {
  475. isHigh = false;
  476. break;
  477. }
  478. }
  479. MultiAnnotPopMenu.SetVisual("MultiCopy", !isHigh);
  480. MultiAnnotPopMenu.SetVisual("MultiCut", !isHigh);
  481. e.PopupMenu = MultiAnnotPopMenu.OpenMenu(e.AnnotEventArgsList, sender);
  482. }
  483. }
  484. if (e.PopupMenu != null)
  485. {
  486. e.Handle = true;
  487. }
  488. }
  489. else
  490. {
  491. if (e.PressOnSelectedText || e.CommandTarget == TargetType.ImageSelection)
  492. {
  493. e.PopupMenu = SelectedTextOrImageContextMenu(sender, e);
  494. if (e.PopupMenu != null)
  495. {
  496. e.Handle = true;
  497. }
  498. }
  499. else
  500. {
  501. e.PopupMenu = ViewerContextMenu(sender);
  502. if (e.PopupMenu != null)
  503. {
  504. e.Handle = true;
  505. }
  506. }
  507. }
  508. break;
  509. }
  510. }
  511. //右键菜单,选中字体样式按钮状态
  512. private void PopMenuCheckedFontFamily(AnnotHandlerEventArgs annot)
  513. {
  514. if (annot != null)
  515. {
  516. if (annot.EventType == AnnotArgsType.AnnotFreeText)
  517. {
  518. var freeText = annot as FreeTextAnnotArgs;
  519. FreeTextAnnotPopMenu.SetIsChecked(freeText.FontFamily.ToString(), true);
  520. }
  521. }
  522. }
  523. //右键菜单,选中文本内容对齐按钮状态
  524. private void PopMenuCheckedTextAglin(AnnotHandlerEventArgs annot)
  525. {
  526. if (annot != null)
  527. {
  528. if (annot.EventType == AnnotArgsType.AnnotFreeText)
  529. {
  530. var freeText = annot as FreeTextAnnotArgs;
  531. switch (freeText.Align)
  532. {
  533. case TextAlignment.Left:
  534. FreeTextAnnotPopMenu.SetIsChecked("FreeTextAglinLeft", true);
  535. break;
  536. case TextAlignment.Center:
  537. FreeTextAnnotPopMenu.SetIsChecked("FreeTextAglinCenter", true);
  538. break;
  539. case TextAlignment.Right:
  540. FreeTextAnnotPopMenu.SetIsChecked("FreeTextAglinRight", true);
  541. break;
  542. case TextAlignment.Justify:
  543. FreeTextAnnotPopMenu.SetIsChecked("FreeTextAglinJustify", true);
  544. break;
  545. default:
  546. FreeTextAnnotPopMenu.SetIsChecked("FreeTextAglinLeft", false);
  547. FreeTextAnnotPopMenu.SetIsChecked("FreeTextAglinCenter", false);
  548. FreeTextAnnotPopMenu.SetIsChecked("FreeTextAglinRight", false);
  549. FreeTextAnnotPopMenu.SetIsChecked("FreeTextAglinJustify", false);
  550. break;
  551. }
  552. }
  553. }
  554. }
  555. //右键菜单,选中虚实线按钮状态
  556. private void PopMenuCheckedLineDash(AnnotHandlerEventArgs annot)
  557. {
  558. if (annot != null)
  559. {
  560. bool isSolidLineDash = true;
  561. if (annot.EventType == AnnotArgsType.AnnotFreehand)
  562. {
  563. var freeHand = annot as FreehandAnnotArgs;
  564. isSolidLineDash = AnnotTransfer.IsSolidStyle(freeHand.LineDash);
  565. FreeHandAnnotPopMenu.SetIsChecked(isSolidLineDash ? "FreeHandSolid" : "FreeHandDash", true);
  566. }
  567. else if (annot.EventType == AnnotArgsType.AnnotSquare)
  568. {
  569. var square = annot as SquareAnnotArgs;
  570. isSolidLineDash = AnnotTransfer.IsSolidStyle(square.LineDash);
  571. ShapeAnnotPopMenu.SetIsChecked(isSolidLineDash ? "ShapeSolid" : "ShapeDash", true);
  572. }
  573. else if (annot.EventType == AnnotArgsType.AnnotCircle)
  574. {
  575. var circle = annot as CircleAnnotArgs;
  576. isSolidLineDash = AnnotTransfer.IsSolidStyle(circle.LineDash);
  577. ShapeAnnotPopMenu.SetIsChecked(isSolidLineDash ? "ShapeSolid" : "ShapeDash", true);
  578. }
  579. else if (annot.EventType == AnnotArgsType.AnnotLine)
  580. {
  581. var line = annot as LineAnnotArgs;
  582. isSolidLineDash = AnnotTransfer.IsSolidStyle(line.LineDash);
  583. ShapeAnnotPopMenu.SetIsChecked(isSolidLineDash ? "ShapeSolid" : "ShapeDash", true);
  584. }
  585. }
  586. }
  587. /// <summary>
  588. /// 内容选择工具
  589. /// </summary>
  590. /// <param name="sender"></param>
  591. /// <param name="e"></param>
  592. private void PDFViewer_SnapshotCommandHandler(object sender, SnapshotCommandArgs e)
  593. {
  594. SnapshotEditToolArgs snapToolArgs = (SnapshotEditToolArgs)PDFViewer.ToolManager.CurrentAnnotArgs;
  595. SnapshotEditMenuViewModel.SnapToolArgs = snapToolArgs;
  596. SnapshotEditMenuViewModel.PDFViewer = PDFViewer;
  597. SnapshotEditMenuViewModel.SnapToolEvent -= SnapshotEditMenuViewModel_SnapToolEvent; ;
  598. SnapshotEditMenuViewModel.SnapToolEvent += SnapshotEditMenuViewModel_SnapToolEvent;
  599. var popMenu = App.Current.FindResource("SnapshotContextMenu") as ContextMenu;
  600. if (e.HitSnapshotTool && e.SnapshotRect.Width > 0 && e.SnapshotRect.Height > 0)
  601. {
  602. e.PopupMenu = popMenu;
  603. e.Handle = true;
  604. if (popMenu != null && popMenu.Items.Count == 5)
  605. {
  606. //复制
  607. MenuItem menuItem = popMenu.Items[0] as MenuItem;
  608. menuItem.CommandTarget = PDFViewer;
  609. menuItem.Command = SnapshotEditMenuViewModel.SnapCopyCommand;
  610. //导出
  611. menuItem = popMenu.Items[1] as MenuItem;
  612. menuItem.CommandTarget = PDFViewer;
  613. if (menuItem.Items.Count == 3)
  614. {
  615. MenuItem menuItem1 = menuItem.Items[0] as MenuItem;
  616. menuItem1.CommandTarget = PDFViewer;
  617. menuItem1.Command = SnapshotEditMenuViewModel.ExportPNGCommand;
  618. menuItem1 = menuItem.Items[1] as MenuItem;
  619. menuItem1.CommandTarget = PDFViewer;
  620. menuItem1.Command = SnapshotEditMenuViewModel.ExportJPGCommand;
  621. menuItem1 = menuItem.Items[2] as MenuItem;
  622. menuItem1.CommandTarget = PDFViewer;
  623. menuItem1.Command = SnapshotEditMenuViewModel.ExportPDFCommand;
  624. }
  625. //裁剪
  626. menuItem = popMenu.Items[2] as MenuItem;
  627. menuItem.CommandTarget = PDFViewer;
  628. menuItem.Command = SnapshotEditMenuViewModel.CroppingCommand;
  629. //缩放至所选区域
  630. menuItem = popMenu.Items[3] as MenuItem;
  631. menuItem.CommandTarget = PDFViewer;
  632. menuItem.Visibility = Visibility.Collapsed;
  633. //menuItem.Command = snapshotEditMenuViewModel.CroppingCommand;
  634. //打印
  635. menuItem = popMenu.Items[4] as MenuItem;
  636. menuItem.CommandTarget = PDFViewer;
  637. menuItem.Command = SnapshotEditMenuViewModel.PrintCommand;
  638. }
  639. }
  640. }
  641. private void SnapshotEditMenuViewModel_SnapToolEvent(object sender, KeyValuePair<string, object> e)
  642. {
  643. switch (e.Key)
  644. {
  645. case "CloseSnap":
  646. {
  647. #region to do
  648. //var item = PDFViewerTab.SelectedItem as TabItem;
  649. //if (item == null)
  650. //{
  651. // ClearSelectedToolPanel();
  652. // return;
  653. //}
  654. //Grid grid = item.Content as Grid;
  655. //if (grid == null || grid.Children.Count == 0)
  656. //{
  657. // ClearSelectedToolPanel();
  658. // return;
  659. //}
  660. //PDFViewerCtrl pdfViewer = grid.Children[0] as PDFViewerCtrl;
  661. //if (pdfViewer == null)
  662. //{
  663. // ClearSelectedToolPanel();
  664. // return;
  665. //}
  666. #endregion to do
  667. switch (PDFViewer.MouseMode)
  668. {
  669. case MouseModes.SelectTextTool:
  670. break;
  671. default:
  672. BtnSelecttoolIsChecked = false;
  673. BtnHandIsChecked = true;
  674. PDFViewer.EnableZoom(true);
  675. PDFViewer.EnableScroll(true);
  676. break;
  677. }
  678. }
  679. break;
  680. default:
  681. break;
  682. }
  683. }
  684. private void PDFViewer_AnnotEditHandler(object sender, List<AnnotEditEvent> e)
  685. {
  686. if (e != null && e.Count > 0)
  687. {
  688. MultipleSelectionAnnot(e);
  689. for (int i = 0; i < e.Count; i++)
  690. {
  691. AnnotEditEvent editEvent = e[i];
  692. switch (editEvent.EditAction)
  693. {
  694. case ActionType.Add:
  695. //BOTA
  696. bool isTabItemAnnotation = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemAnnotation");
  697. if (viewContentViewModel.OpenBOTA == true && isTabItemAnnotation == true)
  698. {
  699. AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
  700. if (viewModel != null)
  701. {
  702. int pageindex = editEvent.PageIndex;
  703. int annotindex = editEvent.AnnotIndex;
  704. viewModel.UpdateAddedAnnot(pageindex, annotindex);
  705. }
  706. }
  707. //添加书签注释,用于未保存前跟图章手绘注释的区分
  708. if (StrAnnotToolChecked == "Signature")
  709. {
  710. AddAnnotSignature(editEvent.EditAnnotArgs);
  711. }
  712. break;
  713. case ActionType.Del:
  714. isTabItemAnnotation = IsBOTATabItemShow(out bOTAContentViewModel, out bOTAContent, "TabItemAnnotation");
  715. if (isTabItemAnnotation)
  716. {
  717. AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
  718. if (viewModel != null)
  719. {
  720. int pageindex = editEvent.PageIndex;
  721. int annotindex = editEvent.AnnotIndex;
  722. viewModel.UpdateModifiedAnnot(pageindex, annotindex, true);
  723. }
  724. }
  725. break;
  726. case ActionType.Modify:
  727. isTabItemAnnotation = IsBOTATabItemShow(out bOTAContentViewModel, out bOTAContent, "TabItemAnnotation");
  728. if (bOTAContent.TabItemAnnotation.IsSelected)
  729. {
  730. AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
  731. if (viewModel != null)
  732. {
  733. int pageindex = editEvent.PageIndex;
  734. int annotindex = editEvent.AnnotIndex;
  735. viewModel.UpdateModifiedAnnot(pageindex, annotindex, false);
  736. }
  737. }
  738. break;
  739. case ActionType.TextEdit:
  740. break;
  741. default:
  742. break;
  743. }
  744. }
  745. //空白处 右键菜单 添加注释 为单次添加,不连续添加
  746. if (IsNoSelectMenu)
  747. {
  748. IsNoSelectMenu = false;
  749. PDFViewer.SetMouseMode(MouseModes.PanTool);
  750. }
  751. }
  752. }
  753. //复制多个注释,粘贴后,默认注释未选中状态
  754. private void MultipleSelectionAnnot(List<AnnotEditEvent> e)
  755. {
  756. bool isAdd = false;
  757. Dictionary<int, List<int>> selectAnnotDicts = new Dictionary<int, List<int>>();
  758. foreach (var item in e)
  759. {
  760. if (item.EditAction == ActionType.Add)
  761. {
  762. var annot = item.EditAnnotArgs;
  763. if (annot.EventType == AnnotArgsType.AnnotSquare || annot.EventType == AnnotArgsType.AnnotCircle ||
  764. annot.EventType == AnnotArgsType.AnnotLine || annot.EventType == AnnotArgsType.AnnotStamp || annot.EventType == AnnotArgsType.AnnotFreeText)
  765. {
  766. if (selectAnnotDicts.ContainsKey(item.PageIndex) == false)
  767. {
  768. selectAnnotDicts.Add(item.PageIndex, new List<int>());
  769. selectAnnotDicts[item.PageIndex].Add(item.AnnotIndex);
  770. }
  771. else
  772. {
  773. selectAnnotDicts[item.PageIndex].Add(item.AnnotIndex);
  774. }
  775. isAdd = true;
  776. }
  777. }
  778. }
  779. if (isAdd)
  780. {
  781. PDFViewer.ClearSelectAnnots();
  782. PDFViewer.SelectAnnotation(selectAnnotDicts);
  783. }
  784. }
  785. //阅读页悬浮相应
  786. private void PDFViewer_AnnotHoverHandler(object sender, AnnotHoverData e)
  787. {
  788. if (e != null && e.DrawContext != null)
  789. {
  790. Rect hoverRect = new Rect(
  791. e.PaintRect.Left - 2,
  792. e.PaintRect.Top - 2,
  793. e.PaintRect.Width + 4,
  794. e.PaintRect.Height + 4);
  795. Pen hoverPen = new Pen(new SolidColorBrush(Color.FromArgb(0xff, 0x11, 0x8A, 0xff)), 1);
  796. hoverPen.DashStyle = DashStyles.Dash;
  797. e.DrawContext?.DrawRectangle(null, hoverPen, hoverRect);
  798. //便签,显示ToolTip内容
  799. if (e.Annot != null && e.Annot.Type == C_ANNOTATION_TYPE.C_ANNOTATION_TEXT)
  800. {
  801. PopAnnotToolTip(e.Annot.GetRect(), hoverRect, e.Annot.GetContent());
  802. return;
  803. }
  804. }
  805. CloseAnnotToolTip();
  806. }
  807. private void PDFViewer_MouseMove(object sender, MouseEventArgs e)
  808. {
  809. if (sender != null && PDFViewer.ToolTip != null && PDFViewer.Parent != null)
  810. {
  811. //鼠标移到注释之外,关闭ToolTip浮窗
  812. var newPoint = e.GetPosition(PDFViewer.Parent as ContentControl);
  813. var isOutw = newPoint.X > (oldRect.X + oldRect.Width + 4);
  814. var isOuth = newPoint.Y > (oldRect.Y + oldRect.Height + 4);
  815. if (newPoint.X < oldRect.X || newPoint.Y < oldRect.Y || isOutw || isOuth)
  816. {
  817. CloseAnnotToolTip();
  818. }
  819. }
  820. }
  821. private Rect oldRect = new Rect(0, 0, 0, 0);
  822. private void PopAnnotToolTip(CRect placementRect, Rect hoverRect, string content)
  823. {
  824. //便签,显示ToolTip内容
  825. if (PDFViewer.ToolTip == null)
  826. {
  827. if (string.IsNullOrEmpty(content) == false)
  828. {
  829. ToolTip TipChild = new ToolTip();
  830. TipChild.Style = App.Current.Resources["FlowToolTip"] as Style;
  831. TipChild.MaxWidth = 246;
  832. TipChild.Content = content;
  833. TipChild.Visibility = Visibility.Visible;
  834. TipChild.IsOpen = true;
  835. TipChild.Placement = PlacementMode.Right;
  836. TipChild.PlacementRectangle = new Rect(placementRect.left, placementRect.top, placementRect.right, placementRect.bottom);
  837. TipChild.PlacementTarget = PDFViewer.Parent as ContentControl;
  838. TipChild.Placement = PlacementMode.MousePoint;
  839. PDFViewer.ToolTip = TipChild;
  840. oldRect = hoverRect;
  841. PDFViewer.MouseMove -= PDFViewer_MouseMove;
  842. PDFViewer.MouseMove += PDFViewer_MouseMove;
  843. }
  844. }
  845. }
  846. //关闭ToolTip
  847. private void CloseAnnotToolTip()
  848. {
  849. if (PDFViewer.ToolTip != null && PDFViewer.ToolTip is ToolTip)
  850. {
  851. ToolTip oldTips = (ToolTip)PDFViewer.ToolTip;
  852. oldTips.IsOpen = false;
  853. oldTips.Visibility = Visibility.Collapsed;
  854. PDFViewer.ToolTip = null;
  855. PDFViewer.MouseMove -= PDFViewer_MouseMove;
  856. oldRect = new Rect(0, 0, 0, 0);
  857. }
  858. }
  859. #endregion PDFViewer事件
  860. #region BindingEvent事件
  861. //同一属性面板,不同的注释类型
  862. private void AnnotPropertyPanel_AnnotTypeChanged(object sender, Dictionary<AnnotArgsType, object> e)
  863. {
  864. if (e != null)
  865. {
  866. AnnotHandlerEventArgs annotArgs = null;
  867. foreach (AnnotArgsType argsType in e.Keys)
  868. {
  869. switch (argsType)
  870. {
  871. case AnnotArgsType.AnnotSquare:
  872. annotArgs = GetRect();
  873. break;
  874. case AnnotArgsType.AnnotCircle:
  875. annotArgs = GetCircle();
  876. break;
  877. case AnnotArgsType.AnnotLine:
  878. var LineTag = e[argsType] as string;
  879. annotArgs = GetArrowLine(LineTag);
  880. break;
  881. }
  882. if (annotArgs != null)
  883. {
  884. annotArgs.Author = Settings.Default.AppProperties.Description.Author;
  885. PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
  886. PDFViewer.SetToolParam(annotArgs);
  887. }
  888. ShowPropertyPanel();
  889. }
  890. }
  891. }
  892. //来自属性面板的事件,更改颜色等属性而触发
  893. private void AnnotPropertyPanel_DataChanged(object sender, Dictionary<AnnotArgsType, object> e)
  894. {
  895. if (e != null)
  896. {
  897. foreach (AnnotArgsType argsType in e.Keys)
  898. {
  899. switch (argsType)
  900. {
  901. case AnnotArgsType.AnnotHighlight:
  902. if (e[argsType] is Color)
  903. {
  904. HighLightColor = new SolidColorBrush((Color)e[argsType]);
  905. }
  906. if (e[argsType] is double)
  907. {
  908. HighLightOpacity = (double)e[argsType];
  909. }
  910. //创建注释后,修改注释属性,可用于下次创建的注释
  911. if (propertyPanel != null && propertyPanel.annot != null && PDFViewer.MouseMode == MouseModes.AnnotCreate)
  912. {
  913. PDFViewer.SetToolParam(propertyPanel.annot);
  914. }
  915. break;
  916. case AnnotArgsType.AnnotUnderline:
  917. if (e[argsType] is Color)
  918. {
  919. UnderLineColor = new SolidColorBrush((Color)e[argsType]);
  920. }
  921. if (e[argsType] is double)
  922. {
  923. underLineOpacity = (double)e[argsType];
  924. }
  925. //创建注释后,修改注释属性,可用于下次创建的注释
  926. if (propertyPanel != null && propertyPanel.annot != null && PDFViewer.MouseMode == MouseModes.AnnotCreate)
  927. {
  928. PDFViewer.SetToolParam(propertyPanel.annot);
  929. }
  930. break;
  931. case AnnotArgsType.AnnotSquiggly:
  932. if (e[argsType] is Color)
  933. {
  934. SquigglyColor = new SolidColorBrush((Color)e[argsType]);
  935. }
  936. if (e[argsType] is double)
  937. {
  938. SquigglyOpacity = (double)e[argsType];
  939. }
  940. //创建注释后,修改注释属性,可用于下次创建的注释
  941. if (propertyPanel != null && propertyPanel.annot != null && PDFViewer.MouseMode == MouseModes.AnnotCreate)
  942. {
  943. PDFViewer.SetToolParam(propertyPanel.annot);
  944. }
  945. break;
  946. case AnnotArgsType.AnnotStrikeout:
  947. if (e[argsType] is Color)
  948. {
  949. StrikeoutColor = new SolidColorBrush((Color)e[argsType]);
  950. }
  951. if (e[argsType] is double)
  952. {
  953. StrikeoutOpacity = (double)e[argsType];
  954. }
  955. //创建注释后,修改注释属性,可用于下次创建的注释
  956. if (propertyPanel != null && propertyPanel.annot != null && PDFViewer.MouseMode == MouseModes.AnnotCreate)
  957. {
  958. PDFViewer.SetToolParam(propertyPanel.annot);
  959. }
  960. break;
  961. case AnnotArgsType.AnnotFreehand:
  962. if (e[argsType] is FreehandAnnotArgs)
  963. {
  964. var annot = e[argsType] as FreehandAnnotArgs;
  965. if (annot != null)
  966. {
  967. if (propertyPanel != null)
  968. {
  969. //属性面板,切换橡皮擦后,再回到画笔时,需要恢复最近画笔的属性值
  970. var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
  971. propertyPanel.AnnotEvent = AnnotEvent;
  972. var AnnotEvents = new List<AnnotAttribEvent>();
  973. AnnotEvents.Add(AnnotEvent);
  974. propertyPanel.AnnotEvents = AnnotEvents;
  975. propertyPanel.annot = annot;
  976. //手绘注释工具按钮的属性
  977. // FreehandPath.Opacity = annot.Transparency;
  978. // FreehandPath.Fill = new SolidColorBrush(annot.InkColor);
  979. }
  980. PDFViewer.SetToolParam(annot);
  981. }
  982. }
  983. break;
  984. case AnnotArgsType.AnnotErase:
  985. if (e[argsType] is ToggleButton)
  986. {
  987. ToggleButton clickBtn = e[argsType] as ToggleButton;
  988. if (clickBtn.IsChecked == true)
  989. {
  990. if (clickBtn.Tag.ToString() == "PenBtn")
  991. {
  992. CustomIconToggleBtn btn = new CustomIconToggleBtn();
  993. btn.Tag = "Freehand"; btn.IsChecked = true;
  994. BtnMyTools_Click(btn);
  995. break;
  996. }
  997. EraseArgs eraseArgs = new EraseArgs();
  998. eraseArgs.UIBorderColor = Color.FromArgb(0x1A, 0x00, 0x00, 0x00);
  999. eraseArgs.UIFillColor = Color.FromArgb(0x1A, 0x00, 0x00, 0x00);
  1000. eraseArgs.Thickness = 10;
  1001. DefaultAnnotProperty annotProperty = SettingHelper.GetAnnotDefaultProperty(AnnotArgsType.AnnotErase);
  1002. if (annotProperty != null)
  1003. {
  1004. eraseArgs.Thickness = annotProperty.Thickness;
  1005. }
  1006. PDFViewer.ClearSelectAnnots(false);
  1007. PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
  1008. PDFViewer.SetToolParam(eraseArgs);
  1009. List<AnnotHandlerEventArgs> eraseArgsList = new List<AnnotHandlerEventArgs>();
  1010. if (eraseArgs != null)
  1011. eraseArgsList.Add(eraseArgs);
  1012. AddToPropertyPanel("FreehandAnnotProperty", "Freehand", eraseArgsList);
  1013. }
  1014. }
  1015. break;
  1016. case AnnotArgsType.AnnotSquare:
  1017. case AnnotArgsType.AnnotCircle:
  1018. case AnnotArgsType.AnnotLine:
  1019. case AnnotArgsType.AnnotFreeText:
  1020. //创建注释后,修改注释属性,可用于下次创建的注释
  1021. if (propertyPanel != null && propertyPanel.annot != null && PDFViewer.MouseMode == MouseModes.AnnotCreate)
  1022. {
  1023. PDFViewer.SetToolParam(propertyPanel.annot);
  1024. }
  1025. break;
  1026. }
  1027. }
  1028. }
  1029. }
  1030. #endregion BindingEvent事件
  1031. }
  1032. }