CPDFDrawModeUI.xaml.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using ComPDFKitViewer;
  2. using System;
  3. using System.Windows;
  4. using System.Windows.Controls;
  5. namespace ComPDFKit.Controls.PDFControlUI
  6. {
  7. public partial class CPDFDrawModeUI : UserControl
  8. {
  9. public event EventHandler<string> SetDrawModeEvent;
  10. public event EventHandler<string> SetCustomDrawModeEvent;
  11. public event EventHandler<DrawModeData> DrawModeChanged;
  12. public CPDFDrawModeUI()
  13. {
  14. InitializeComponent();
  15. }
  16. private void DrawMode_Click(object sender, RoutedEventArgs e)
  17. {
  18. var drawModeRadioButton = sender as RadioButton;
  19. SetDrawModeEvent?.Invoke(sender, drawModeRadioButton.Tag as string);
  20. }
  21. private void DrawModeNormal_Click(object sender, RoutedEventArgs e)
  22. {
  23. DrawModeChanged?.Invoke(sender, new DrawModeData()
  24. {
  25. DrawMode = DrawMode.Normal
  26. }) ;
  27. }
  28. private void DrawModeSoft_Click(object sender, RoutedEventArgs e)
  29. {
  30. DrawModeChanged?.Invoke(sender, new DrawModeData()
  31. {
  32. DrawMode = DrawMode.Soft
  33. });
  34. }
  35. private void DrawModeDark_Click(object sender, RoutedEventArgs e)
  36. {
  37. DrawModeChanged?.Invoke(sender, new DrawModeData()
  38. {
  39. DrawMode = DrawMode.Dark
  40. });
  41. }
  42. private void DrawModeGreen_Click(object sender, RoutedEventArgs e)
  43. {
  44. DrawModeChanged?.Invoke(sender, new DrawModeData()
  45. {
  46. DrawMode = DrawMode.Green
  47. });
  48. }
  49. private void DrawModeOrange_Click(object sender, RoutedEventArgs e)
  50. {
  51. DrawModeChanged?.Invoke(sender, new DrawModeData()
  52. {
  53. DrawMode = DrawMode.Custom,
  54. CustomColor= 0xFFFFE390
  55. });
  56. }
  57. private void DrawModeLightBlue_Click(object sender, RoutedEventArgs e)
  58. {
  59. DrawModeChanged?.Invoke(sender, new DrawModeData()
  60. {
  61. DrawMode = DrawMode.Custom,
  62. CustomColor= 0xFFC1E6FF
  63. });
  64. }
  65. }
  66. public class DrawModeData
  67. {
  68. public DrawMode DrawMode { get; set; }
  69. public uint CustomColor { get; set; }
  70. }
  71. }