CPDFDrawModeControl.xaml.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using ComPDFKitViewer;
  2. using ComPDFKitViewer.PdfViewer;
  3. using System.Collections.Generic;
  4. using System.Windows;
  5. using System.Windows.Controls;
  6. namespace Compdfkit_Tools.PDFControl
  7. {
  8. public partial class CPDFDrawModeControl : UserControl
  9. {
  10. public CPDFViewer pdfViewer;
  11. public Dictionary<string, DrawModes> GetDrawMode = new Dictionary<string, DrawModes>();
  12. public CPDFDrawModeControl()
  13. {
  14. InitializeComponent();
  15. CPDFDrawModeUI.Loaded += CPDFDrawModeUI_Loaded;
  16. }
  17. private void CPDFDrawModeUI_Loaded(object sender, RoutedEventArgs e)
  18. {
  19. GetDrawMode.Clear();
  20. GetDrawMode.Add("Normal", DrawModes.Draw_Mode_Normal);
  21. GetDrawMode.Add("Soft", DrawModes.Draw_Mode_Soft);
  22. GetDrawMode.Add("Dark", DrawModes.Draw_Mode_Dark);
  23. GetDrawMode.Add("Green", DrawModes.Draw_Mode_Green);
  24. GetDrawMode.Add("Custom", DrawModes.Draw_Mode_Custom);
  25. CPDFDrawModeUI.SetDrawModeEvent += CPDFDrawModeUI_SetDrawModeEvent;
  26. }
  27. private void CPDFDrawModeUI_SetDrawModeEvent(object sender, string e)
  28. {
  29. pdfViewer.SetDrawMode(GetDrawMode[(sender as RadioButton).Tag as string]);
  30. }
  31. public void InitWithPDFViewer(CPDFViewer pdfViewer)
  32. {
  33. this.pdfViewer = pdfViewer;
  34. }
  35. }
  36. }