AnnotToolContentViewModel.Command.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  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. namespace PDF_Office.ViewModels.Tools
  27. {
  28. public sealed partial class AnnotToolContentViewModel : BindableBase, INavigationAware
  29. {
  30. #region 事件绑定和解绑
  31. private void BindingEvent()
  32. {
  33. //属性面板与注释工具栏绑定:属性面板的属性变化,会同步注释工具栏的属性值
  34. //比如在属性面板里更改注释颜色,会同时更新工具栏对应的工具颜色
  35. propertyPanel.DataChanged -= AnnotPropertyPanel_DataChanged;
  36. propertyPanel.DataChanged += AnnotPropertyPanel_DataChanged;
  37. propertyPanel.DefaultStored -= AnnotProperty_DefaultStored;
  38. propertyPanel.DefaultStored += AnnotProperty_DefaultStored;
  39. propertyPanel.AnnotTypeChanged -= AnnotPropertyPanel_AnnotTypeChanged;
  40. propertyPanel.AnnotTypeChanged += AnnotPropertyPanel_AnnotTypeChanged;
  41. }
  42. private void UnBindingEvent()
  43. {
  44. propertyPanel.DataChanged -= AnnotPropertyPanel_DataChanged;
  45. propertyPanel.DefaultStored -= AnnotProperty_DefaultStored;
  46. propertyPanel.AnnotTypeChanged -= AnnotPropertyPanel_AnnotTypeChanged;
  47. }
  48. private void BindingPDFViewerHandler()
  49. {
  50. //来自PDFViewer的响应事件
  51. if (PDFViewer != null)
  52. {
  53. PDFViewer.AnnotEditHandler -= PDFViewer_AnnotEditHandler;
  54. PDFViewer.AnnotEditHandler += PDFViewer_AnnotEditHandler;
  55. PDFViewer.AnnotActiveHandler -= PDFViewer_AnnotActiveHandler;
  56. PDFViewer.AnnotActiveHandler += PDFViewer_AnnotActiveHandler;
  57. PDFViewer.AnnotCommandHandler -= PDFViewer_AnnotCommandHandler;
  58. PDFViewer.AnnotCommandHandler += PDFViewer_AnnotCommandHandler;
  59. PDFViewer.WidgetClickHander -= PDFViewer_WidgetClickHander;
  60. PDFViewer.WidgetClickHander += PDFViewer_WidgetClickHander;
  61. PDFViewer.SnapshotCommandHandler -= PDFViewer_SnapshotCommandHandler;
  62. PDFViewer.SnapshotCommandHandler += PDFViewer_SnapshotCommandHandler;
  63. PDFViewer.PDFActionHandler -= PDFViewer_PDFActionHandler;
  64. PDFViewer.PDFActionHandler += PDFViewer_PDFActionHandler;
  65. }
  66. }
  67. private void PDFViewer_PDFActionHandler(object sender, ComPDFKit.PDFDocument.Action.CPDFAction action)
  68. {
  69. if (action == null)
  70. {
  71. return;
  72. }
  73. switch (action.ActionType)
  74. {
  75. case C_ACTION_TYPE.ACTION_TYPE_GOTO:
  76. if (PDFViewer != null)
  77. {
  78. CPDFGoToAction gotoAction = action as CPDFGoToAction;
  79. CPDFDestination dest = gotoAction.GetDestination(PDFViewer.Document);
  80. if (dest != null)
  81. {
  82. PDFViewer.GoToPage(dest.PageIndex, new System.Windows.Point(0, 0));
  83. }
  84. }
  85. break;
  86. case C_ACTION_TYPE.ACTION_TYPE_URI:
  87. {
  88. CPDFUriAction uriAction = action as CPDFUriAction;
  89. string uri = uriAction.GetUri();
  90. try
  91. {
  92. if (!string.IsNullOrEmpty(uri))
  93. {
  94. Process.Start(uri);
  95. }
  96. }
  97. catch (Exception ex)
  98. {
  99. }
  100. }
  101. break;
  102. }
  103. }
  104. private void UnBindingPDFViewerHandler()
  105. {
  106. if (PDFViewer != null)
  107. {
  108. PDFViewer.AnnotEditHandler -= PDFViewer_AnnotEditHandler;
  109. PDFViewer.AnnotActiveHandler -= PDFViewer_AnnotActiveHandler;
  110. PDFViewer.AnnotCommandHandler -= PDFViewer_AnnotCommandHandler;
  111. PDFViewer.WidgetClickHander -= PDFViewer_WidgetClickHander;
  112. PDFViewer.SnapshotCommandHandler -= PDFViewer_SnapshotCommandHandler;
  113. }
  114. }
  115. #endregion 事件绑定和解绑
  116. #region PDFViewer事件
  117. //选中和非选中注释,右键菜单
  118. private void PDFViewer_AnnotActiveHandler(object sender, AnnotAttribEvent e)
  119. {
  120. if (e != null)
  121. {
  122. var annot = e.AnnotItemsList[0];
  123. if (annot != null)
  124. {
  125. if (e.AnnotItemsList.Count == 1)
  126. {
  127. //IsAnnotCreateReset:是否为创建注释的状态
  128. if (e.IsAnnotCreateReset == false)
  129. {
  130. GetSelectedAnnots(e);
  131. //记录这次选中的注释,之后创建注释会跟随上次选中注释的属性值
  132. PDFViewer.SetToolParam(annot);
  133. }
  134. else
  135. {
  136. switch (annot.EventType)
  137. {
  138. case AnnotArgsType.AnnotLink:
  139. //viewContentViewModel.IsCreateLink = false;
  140. GetLink(e.AnnotItemsList, e);
  141. PDFViewer.SetToolParam(annot);
  142. break;
  143. }
  144. //TODO: 设计已重新调整为(仅限高亮注释):修改注释后,会作用到之后添加的注释中。因此先把此逻辑“创建注释后,会自动回到默认值”注释掉
  145. if (annot.EventType != AnnotArgsType.AnnotStrikeout &&
  146. annot.EventType != AnnotArgsType.AnnotUnderline &&
  147. annot.EventType != AnnotArgsType.AnnotHighlight &&
  148. annot.EventType != AnnotArgsType.AnnotSquiggly &&
  149. annot.EventType != AnnotArgsType.AnnotLink &&
  150. annot.EventType != AnnotArgsType.AnnotFreehand &&
  151. annot.EventType != AnnotArgsType.AnnotSticky
  152. )
  153. {
  154. if (ToolExpandDict.ContainsValue(e.AnnotItemsList[0].EventType))
  155. {
  156. foreach (var item in ToolExpandDict)
  157. {
  158. if (item.Value == e.AnnotItemsList[0].EventType)
  159. {
  160. annot = null;//新建注释时,回到默认值
  161. FindAnnotTypeKey(item.Key, ref annot);
  162. break;
  163. }
  164. }
  165. }
  166. }
  167. //else
  168. PDFViewer.SetToolParam(annot);
  169. //设计重新调整,阅读页空白处,右键菜单,添加链接,和pro mac一样的效果,不显示属性栏
  170. if (isRightMenuAddAnnot)
  171. {
  172. ShowPropertyPanel(false);
  173. }
  174. else
  175. {
  176. ShowPropertyPanel();
  177. }
  178. }
  179. }
  180. else
  181. {
  182. GetSelectedAnnots(e);
  183. }
  184. }
  185. }
  186. else
  187. {
  188. viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
  189. }
  190. }
  191. private void GetSelectedAnnots(AnnotAttribEvent e)
  192. {
  193. var annot = e.AnnotItemsList[0];
  194. switch (annot.EventType)
  195. {
  196. case AnnotArgsType.AnnotHighlight:
  197. GetHighLight(e.AnnotItemsList);
  198. break;
  199. case AnnotArgsType.AnnotUnderline:
  200. GetUnderLine(e.AnnotItemsList);
  201. break;
  202. case AnnotArgsType.AnnotStrikeout:
  203. GetStrikeout(e.AnnotItemsList);
  204. break;
  205. case AnnotArgsType.AnnotSquiggly:
  206. GetSquiggly(e.AnnotItemsList);
  207. break;
  208. case AnnotArgsType.AnnotFreehand:
  209. GetFreehand(e.AnnotItemsList);
  210. break;
  211. case AnnotArgsType.AnnotFreeText:
  212. GetFreetext(e.AnnotItemsList);
  213. break;
  214. case AnnotArgsType.AnnotSquare:
  215. GetRect(e.AnnotItemsList);
  216. break;
  217. case AnnotArgsType.AnnotCircle:
  218. GetCircle(e.AnnotItemsList);
  219. break;
  220. case AnnotArgsType.AnnotLine:
  221. bool isLine = true;
  222. if (e.Attribs.ContainsKey(AnnotAttrib.LineStart))
  223. {
  224. 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)
  225. {
  226. isLine = false;
  227. }
  228. }
  229. if (e.Attribs.ContainsKey(AnnotAttrib.LineEnd))
  230. {
  231. 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)
  232. {
  233. isLine = false;
  234. }
  235. }
  236. if (isLine)
  237. GetArrowLine("Line", e.AnnotItemsList);
  238. else
  239. GetArrowLine("Arrow", e.AnnotItemsList);
  240. break;
  241. case AnnotArgsType.AnnotLink:
  242. //viewContentViewModel.IsCreateLink = false;
  243. GetLink(e.AnnotItemsList, e);
  244. break;
  245. case AnnotArgsType.AnnotSticky:
  246. GetStickyNote(e.AnnotItemsList);
  247. break;
  248. }
  249. }
  250. //在注释工具的状态下,右键菜单
  251. private void PDFViewer_AnnotCommandHandler(object sender, AnnotCommandArgs e)
  252. {
  253. if (e.AnnotEventArgsList == null || (PDFViewer != null && PDFViewer.MouseMode == MouseModes.FormEditTool))
  254. return;
  255. switch (e.CommandType)
  256. {
  257. case CommandType.Context:
  258. if (e.AnnotEventArgsList.Count > 0)
  259. {
  260. if (App.mainWindowViewModel.SelectedItem.IsInReadctonMode && e.AnnotEventArgsList[0].EventType == AnnotArgsType.AnnotRedaction)
  261. {
  262. //绑定标记密文处右键菜单
  263. events.GetEvent<RedactionCommandEvent>().Publish(new RedactionCommandEventArgs() { UniCode = App.mainWindowViewModel.SelectedItem.Unicode, Sender = sender, args = e });
  264. }
  265. else
  266. {
  267. e.PopupMenu = SelectAnnotContextMenu(sender);
  268. }
  269. if (e.PopupMenu != null)
  270. {
  271. e.Handle = true;
  272. }
  273. }
  274. else
  275. {
  276. if (e.PressOnSelectedText || e.CommandTarget == TargetType.ImageSelection)
  277. {
  278. e.PopupMenu = NoneSelectAnnotContextMenu(sender, e);
  279. if (e.PopupMenu != null)
  280. {
  281. e.Handle = true;
  282. }
  283. }
  284. else
  285. {
  286. e.PopupMenu = ViewerContextMenu();
  287. if (e.PopupMenu != null)
  288. {
  289. e.Handle = true;
  290. }
  291. }
  292. }
  293. break;
  294. }
  295. }
  296. private void PDFViewer_SnapshotCommandHandler(object sender, SnapshotCommandArgs e)
  297. {
  298. SnapshotEditToolArgs snapToolArgs = (SnapshotEditToolArgs)PDFViewer.ToolManager.CurrentAnnotArgs;
  299. SnapshotEditMenuViewModel.SnapToolArgs = snapToolArgs;
  300. SnapshotEditMenuViewModel.PDFViewer = PDFViewer;
  301. SnapshotEditMenuViewModel.SnapToolEvent -= SnapshotEditMenuViewModel_SnapToolEvent; ;
  302. SnapshotEditMenuViewModel.SnapToolEvent += SnapshotEditMenuViewModel_SnapToolEvent;
  303. var popMenu = App.Current.FindResource("SnapshotContextMenu") as ContextMenu;
  304. if (e.HitSnapshotTool && e.SnapshotRect.Width > 0 && e.SnapshotRect.Height > 0)
  305. {
  306. e.PopupMenu = popMenu;
  307. e.Handle = true;
  308. if (popMenu != null && popMenu.Items.Count == 5)
  309. {
  310. //复制
  311. MenuItem menuItem = popMenu.Items[0] as MenuItem;
  312. menuItem.CommandTarget = PDFViewer;
  313. menuItem.Command = SnapshotEditMenuViewModel.SnapCopyCommand;
  314. //导出
  315. menuItem = popMenu.Items[1] as MenuItem;
  316. menuItem.CommandTarget = PDFViewer;
  317. if (menuItem.Items.Count == 3)
  318. {
  319. MenuItem menuItem1 = menuItem.Items[0] as MenuItem;
  320. menuItem1.CommandTarget = PDFViewer;
  321. menuItem1.Command = SnapshotEditMenuViewModel.ExportPNGCommand;
  322. menuItem1 = menuItem.Items[1] as MenuItem;
  323. menuItem1.CommandTarget = PDFViewer;
  324. menuItem1.Command = SnapshotEditMenuViewModel.ExportJPGCommand;
  325. menuItem1 = menuItem.Items[2] as MenuItem;
  326. menuItem1.CommandTarget = PDFViewer;
  327. menuItem1.Command = SnapshotEditMenuViewModel.ExportPDFCommand;
  328. }
  329. //裁剪
  330. menuItem = popMenu.Items[2] as MenuItem;
  331. menuItem.CommandTarget = PDFViewer;
  332. menuItem.Command = SnapshotEditMenuViewModel.CroppingCommand;
  333. //缩放至所选区域
  334. menuItem = popMenu.Items[3] as MenuItem;
  335. menuItem.CommandTarget = PDFViewer;
  336. menuItem.Visibility = Visibility.Collapsed;
  337. //menuItem.Command = snapshotEditMenuViewModel.CroppingCommand;
  338. //打印
  339. menuItem = popMenu.Items[4] as MenuItem;
  340. menuItem.CommandTarget = PDFViewer;
  341. menuItem.Command = SnapshotEditMenuViewModel.PrintCommand;
  342. }
  343. }
  344. }
  345. private void SnapshotEditMenuViewModel_SnapToolEvent(object sender, KeyValuePair<string, object> e)
  346. {
  347. switch (e.Key)
  348. {
  349. case "CloseSnap":
  350. {
  351. #region to do
  352. //var item = PDFViewerTab.SelectedItem as TabItem;
  353. //if (item == null)
  354. //{
  355. // ClearSelectedToolPanel();
  356. // return;
  357. //}
  358. //Grid grid = item.Content as Grid;
  359. //if (grid == null || grid.Children.Count == 0)
  360. //{
  361. // ClearSelectedToolPanel();
  362. // return;
  363. //}
  364. //PDFViewerCtrl pdfViewer = grid.Children[0] as PDFViewerCtrl;
  365. //if (pdfViewer == null)
  366. //{
  367. // ClearSelectedToolPanel();
  368. // return;
  369. //}
  370. #endregion to do
  371. switch (PDFViewer.MouseMode)
  372. {
  373. case MouseModes.SelectTextTool:
  374. break;
  375. default:
  376. BtnSelecttoolIsChecked = false;
  377. BtnHandIsChecked = true;
  378. PDFViewer.EnableZoom(true);
  379. PDFViewer.EnableScroll(true);
  380. break;
  381. }
  382. }
  383. break;
  384. default:
  385. break;
  386. }
  387. }
  388. private void PDFViewer_AnnotEditHandler(object sender, List<AnnotEditEvent> e)
  389. {
  390. if (e != null && e.Count > 0)
  391. {
  392. for (int i = 0; i < e.Count; i++)
  393. {
  394. AnnotEditEvent editEvent = e[i];
  395. switch (editEvent.EditAction)
  396. {
  397. case ActionType.Add:
  398. bool isTabItemAnnotation = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemAnnotation");
  399. if (viewContentViewModel.OpenBOTA == true && isTabItemAnnotation == true)
  400. {
  401. AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel);
  402. if (viewModel != null)
  403. {
  404. int pageindex = editEvent.PageIndex;
  405. int annotindex = editEvent.AnnotIndex;
  406. viewModel.UpdateAddedAnnot(pageindex, annotindex);
  407. }
  408. }
  409. break;
  410. case ActionType.Del:
  411. isTabItemAnnotation = IsBOTATabItemShow(out bOTAContentViewModel, out bOTAContent, "TabItemAnnotation");
  412. if (isTabItemAnnotation)
  413. {
  414. AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel);
  415. if (viewModel != null)
  416. {
  417. int pageindex = editEvent.PageIndex;
  418. int annotindex = editEvent.AnnotIndex;
  419. viewModel.UpdateModifiedAnnot(pageindex, annotindex, true);
  420. }
  421. }
  422. break;
  423. case ActionType.Modify:
  424. isTabItemAnnotation = IsBOTATabItemShow(out bOTAContentViewModel, out bOTAContent, "TabItemAnnotation");
  425. if (isTabItemAnnotation)
  426. {
  427. AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel);
  428. if (viewModel != null)
  429. {
  430. int pageindex = editEvent.PageIndex;
  431. int annotindex = editEvent.AnnotIndex;
  432. viewModel.UpdateModifiedAnnot(pageindex, annotindex, false);
  433. }
  434. }
  435. break;
  436. case ActionType.TextEdit:
  437. break;
  438. default:
  439. break;
  440. }
  441. }
  442. }
  443. }
  444. private void PDFViewer_WidgetClickHander(object sender, WidgetArgs e)
  445. {
  446. }
  447. #endregion PDFViewer事件
  448. #region BindingEvent事件
  449. private void AnnotProperty_DefaultStored(object sender, object e)
  450. {
  451. }
  452. private void AnnotPropertyPanel_AnnotTypeChanged(object sender, Dictionary<AnnotArgsType, object> e)
  453. {
  454. if (e != null)
  455. {
  456. AnnotHandlerEventArgs annotArgs = null;
  457. foreach (AnnotArgsType argsType in e.Keys)
  458. {
  459. switch (argsType)
  460. {
  461. case AnnotArgsType.AnnotSquare:
  462. annotArgs = GetRect();
  463. break;
  464. case AnnotArgsType.AnnotCircle:
  465. annotArgs = GetCircle();
  466. break;
  467. case AnnotArgsType.AnnotLine:
  468. var LineTag = e[argsType] as string;
  469. annotArgs = GetArrowLine(LineTag);
  470. break;
  471. }
  472. if (annotArgs != null)
  473. {
  474. annotArgs.Author = Settings.Default.AppProperties.Description.Author;
  475. PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
  476. PDFViewer.SetToolParam(annotArgs);
  477. }
  478. ShowPropertyPanel();
  479. }
  480. }
  481. }
  482. private void AnnotPropertyPanel_DataChanged(object sender, Dictionary<AnnotArgsType, object> e)
  483. {
  484. if (e != null)
  485. {
  486. foreach (AnnotArgsType argsType in e.Keys)
  487. {
  488. switch (argsType)
  489. {
  490. case AnnotArgsType.AnnotHighlight:
  491. if (e[argsType] is Color)
  492. {
  493. HighLightColor = new SolidColorBrush((Color)e[argsType]);
  494. }
  495. if (e[argsType] is double)
  496. {
  497. HighLightOpacity = (double)e[argsType];
  498. }
  499. break;
  500. case AnnotArgsType.AnnotUnderline:
  501. if (e[argsType] is Color)
  502. {
  503. UnderLineColor = new SolidColorBrush((Color)e[argsType]);
  504. }
  505. if (e[argsType] is double)
  506. {
  507. underLineOpacity = (double)e[argsType];
  508. }
  509. break;
  510. case AnnotArgsType.AnnotSquiggly:
  511. if (e[argsType] is Color)
  512. {
  513. SquigglyColor = new SolidColorBrush((Color)e[argsType]);
  514. }
  515. if (e[argsType] is double)
  516. {
  517. SquigglyOpacity = (double)e[argsType];
  518. }
  519. break;
  520. case AnnotArgsType.AnnotStrikeout:
  521. if (e[argsType] is Color)
  522. {
  523. StrikeoutColor = new SolidColorBrush((Color)e[argsType]);
  524. }
  525. if (e[argsType] is double)
  526. {
  527. StrikeoutOpacity = (double)e[argsType];
  528. }
  529. break;
  530. case AnnotArgsType.AnnotFreehand:
  531. if (e[argsType] is Color)
  532. {
  533. // FreehandPath.Fill = new SolidColorBrush((Color)e[argsType]);
  534. }
  535. if (e[argsType] is double)
  536. {
  537. // FreehandPath.Opacity = (double)e[argsType];
  538. }
  539. break;
  540. case AnnotArgsType.AnnotErase:
  541. if (e[argsType] is ToggleButton)
  542. {
  543. ToggleButton clickBtn = e[argsType] as ToggleButton;
  544. if (clickBtn.IsChecked == true)
  545. {
  546. if (clickBtn.Tag.ToString() == "PenBtn")
  547. {
  548. CustomIconToggleBtn btn = new CustomIconToggleBtn();
  549. btn.Tag = "Freehand"; btn.IsChecked = true;
  550. BtnMyTools_Click(btn);
  551. break;
  552. }
  553. EraseArgs eraseArgs = new EraseArgs();
  554. eraseArgs.UIBorderColor = Color.FromArgb(0x1A, 0x00, 0x00, 0x00);
  555. eraseArgs.UIFillColor = Color.FromArgb(0x1A, 0x00, 0x00, 0x00);
  556. eraseArgs.Thickness = 10;
  557. DefaultAnnotProperty annotProperty = SettingHelper.GetAnnotDefaultProperty(AnnotArgsType.AnnotErase);
  558. if (annotProperty != null)
  559. {
  560. eraseArgs.Thickness = annotProperty.Thickness;
  561. }
  562. PDFViewer.ClearSelectAnnots(false);
  563. PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
  564. PDFViewer.SetToolParam(eraseArgs);
  565. Dictionary<AnnotAttrib, object> annotAttribsList = new Dictionary<AnnotAttrib, object>();
  566. annotAttribsList[AnnotAttrib.Color] = eraseArgs.UIBorderColor;
  567. annotAttribsList[AnnotAttrib.FillColor] = eraseArgs.UIFillColor;
  568. annotAttribsList[AnnotAttrib.Thickness] = eraseArgs.Thickness;
  569. List<AnnotHandlerEventArgs> eraseArgsList = new List<AnnotHandlerEventArgs>();
  570. if (eraseArgs != null)
  571. eraseArgsList.Add(eraseArgs);
  572. AddToPropertyPanel("FreehandAnnotProperty", "Freehand", eraseArgsList, annotAttribsList);
  573. }
  574. }
  575. break;
  576. }
  577. }
  578. }
  579. }
  580. #endregion BindingEvent事件
  581. }
  582. }