CPDFDrawModeUI.xaml.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using ComPDFKitViewer;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Drawing.Imaging;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. namespace Compdfkit_Tools.PDFControlUI
  18. {
  19. public partial class CPDFDrawModeUI : UserControl
  20. {
  21. public event EventHandler<string> SetDrawModeEvent;
  22. public event EventHandler<string> SetCustomDrawModeEvent;
  23. public event EventHandler<DrawModeData> DrawModeChanged;
  24. public CPDFDrawModeUI()
  25. {
  26. InitializeComponent();
  27. }
  28. private void DrawMode_Click(object sender, RoutedEventArgs e)
  29. {
  30. var drawModeRadioButton = sender as RadioButton;
  31. SetDrawModeEvent?.Invoke(sender, drawModeRadioButton.Tag as string);
  32. }
  33. private void DrawModeNormal_Click(object sender, RoutedEventArgs e)
  34. {
  35. DrawModeChanged?.Invoke(sender, new DrawModeData()
  36. {
  37. DrawMode = DrawModes.Draw_Mode_Normal
  38. }) ;
  39. }
  40. private void DrawModeSoft_Click(object sender, RoutedEventArgs e)
  41. {
  42. DrawModeChanged?.Invoke(sender, new DrawModeData()
  43. {
  44. DrawMode = DrawModes.Draw_Mode_Soft
  45. });
  46. }
  47. private void DrawModeDark_Click(object sender, RoutedEventArgs e)
  48. {
  49. DrawModeChanged?.Invoke(sender, new DrawModeData()
  50. {
  51. DrawMode = DrawModes.Draw_Mode_Dark
  52. });
  53. }
  54. private void DrawModeGreen_Click(object sender, RoutedEventArgs e)
  55. {
  56. DrawModeChanged?.Invoke(sender, new DrawModeData()
  57. {
  58. DrawMode = DrawModes.Draw_Mode_Green
  59. });
  60. }
  61. private void DrawModeOrange_Click(object sender, RoutedEventArgs e)
  62. {
  63. DrawModeChanged?.Invoke(sender, new DrawModeData()
  64. {
  65. DrawMode = DrawModes.Draw_Mode_Custom,
  66. CustomColor= 0xFFFFE390
  67. });
  68. }
  69. private void DrawModeLightBlue_Click(object sender, RoutedEventArgs e)
  70. {
  71. DrawModeChanged?.Invoke(sender, new DrawModeData()
  72. {
  73. DrawMode = DrawModes.Draw_Mode_Custom,
  74. CustomColor= 0xFFC1E6FF
  75. });
  76. }
  77. }
  78. public class DrawModeData
  79. {
  80. public DrawModes DrawMode { get; set; }
  81. public uint CustomColor { get; set; }
  82. }
  83. }