CPDFDrawModeControl.xaml.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using ComPDFKitViewer;
  2. using System.Collections.Generic;
  3. using System.Windows;
  4. using System.Windows.Controls;
  5. namespace Compdfkit_Tools.PDFControl
  6. {
  7. public partial class CPDFDrawModeControl : UserControl
  8. {
  9. public PDFViewControl ViewControl;
  10. public Dictionary<string, DrawModess> GetDrawMode = new Dictionary<string, DrawModess>();
  11. public CPDFDrawModeControl()
  12. {
  13. InitializeComponent();
  14. CPDFDrawModeUI.Loaded += CPDFDrawModeUI_Loaded;
  15. }
  16. private void CPDFDrawModeUI_Loaded(object sender, RoutedEventArgs e)
  17. {
  18. GetDrawMode.Clear();
  19. GetDrawMode.Add("Normal", DrawModess.Normal);
  20. GetDrawMode.Add("Soft", DrawModess.Soft);
  21. GetDrawMode.Add("Dark", DrawModess.Dark);
  22. GetDrawMode.Add("Green", DrawModess.Green);
  23. GetDrawMode.Add("Custom", DrawModess.Custom);
  24. CPDFDrawModeUI.SetDrawModeEvent += CPDFDrawModeUI_SetDrawModeEvent;
  25. }
  26. private void CPDFDrawModeUI_SetDrawModeEvent(object sender, string e)
  27. {
  28. if(ViewControl != null && ViewControl.PDFViewTool!=null)
  29. {
  30. CPDFViewer pdfViewer=ViewControl.PDFViewTool.GetCPDFViewer();
  31. pdfViewer?.SetDrawModes(GetDrawMode[(sender as RadioButton).Tag as string]);
  32. }
  33. }
  34. public void InitWithPDFViewer(PDFViewControl viewControl)
  35. {
  36. this.ViewControl = viewControl;
  37. }
  38. }
  39. }