CPDFTempStampUI.xaml.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using ComPDFKitViewer.AnnotEvent;
  2. using ComPDFKitViewer;
  3. using System.Windows.Controls;
  4. using System.Windows.Media.Imaging;
  5. namespace Compdfkit_Tools.PDFControlUI
  6. {
  7. /// <summary>
  8. /// Interaction logic for CPDFImageUI.xaml
  9. /// </summary>
  10. public partial class CPDFTempStampUI : UserControl
  11. {
  12. private AnnotAttribEvent annotAttribEvent;
  13. public CPDFTempStampUI()
  14. {
  15. InitializeComponent();
  16. }
  17. public void SetPresentAnnotAttrib(AnnotAttribEvent annotAttribEvent)
  18. {
  19. this.annotAttribEvent = null;
  20. NoteTextBox.Text = (string)annotAttribEvent.Attribs[AnnotAttrib.NoteText];
  21. this.annotAttribEvent = annotAttribEvent;
  22. WriteableBitmap writeableBitmap = (annotAttribEvent.GetAnnotHandlerEventArgs(AnnotArgsType.AnnotStamp)[0] as StampAnnotArgs).GetStampDrawing();
  23. CPDFAnnotationPreviewerControl.DrawStampPreview(writeableBitmap);
  24. }
  25. private void NoteTextBox_TextChanged(object sender, TextChangedEventArgs e)
  26. {
  27. if(annotAttribEvent != null)
  28. {
  29. annotAttribEvent.UpdateAttrib(AnnotAttrib.NoteText, NoteTextBox.Text);
  30. annotAttribEvent.UpdateAnnot();
  31. }
  32. }
  33. }
  34. }