123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- using Compdfkit_Tools.PDFControlUI;
- using ComPDFKitViewer;
- using System.Collections.Generic;
- using System.Windows;
- using System.Windows.Controls;
- namespace Compdfkit_Tools.PDFControl
- {
- public partial class CPDFDisplaySettingsControl : UserControl
- {
- /// <summary>
- /// PDFViewer
- /// </summary>
- private PDFViewControl ViewControl;
- public CPDFDisplaySettingsControl()
- {
- InitializeComponent();
- Loaded += CPDFDisplaySettingsControl_Loaded;
- }
- private void CPDFDisplaySettingsControl_Loaded(object sender, RoutedEventArgs e)
- {
- ViewModeUI.ViewModeChanged += ViewModeUI_ViewModeChanged;
- //ViewModeUI.SplitModeChanged += ViewModeUI_SplitModeChanged;
- ViewModeUI.CropModeChanged += ViewModeUI_CropModeChanged;
- DrawModeUI.DrawModeChanged += DrawModeUI_DrawModeChanged;
- }
- private void ViewModeUI_CropModeChanged(object sender, bool e)
- {
- //ViewControl?.SetCropMode(e);
- }
- private void DrawModeUI_DrawModeChanged(object sender, DrawModeData e)
- {
- if(ViewControl!=null && ViewControl.PDFViewTool!=null)
- {
- CPDFViewer pdfViewer=ViewControl.PDFViewTool.GetCPDFViewer();
- if(pdfViewer!=null)
- {
- if (e.DrawMode != DrawModess.Custom)
- {
- pdfViewer?.SetDrawModes(e.DrawMode);
- pdfViewer?.UpDateRenderFrame();
- }
- else
- {
- pdfViewer?.SetDrawModes(e.DrawMode);
- pdfViewer?.SetPDFBackground(e.CustomColor);
- pdfViewer?.UpDateRenderFrame();
- }
- }
- }
- }
- //private void ViewModeUI_SplitModeChanged(object sender, SplitMode e)
- //{
- // ViewControl?.SetSplitMode(e);
- //}
- private void ViewModeUI_ViewModeChanged(object sender, ViewModes e)
- {
- if (ViewControl != null && ViewControl.PDFViewTool != null)
- {
- CPDFViewer pdfViewer = ViewControl.PDFViewTool.GetCPDFViewer();
- if (pdfViewer != null)
- {
- pdfViewer?.SetViewMode(e);
- pdfViewer?.UpDateRenderFrame();
- }
- }
- }
- public void InitWithPDFViewer(PDFViewControl viewControl)
- {
- ViewControl = viewControl;
- if(ViewControl != null && ViewControl.PDFViewTool!=null)
- {
- CPDFViewer pdfViewer= viewControl.PDFViewTool.GetCPDFViewer();
- if(pdfViewer != null)
- {
- ViewModeUI.SetViewModeUI(pdfViewer.GetViewMode());
- // ViewModeUI.SetSplitModeUI(ViewControl.Mode);
- //ViewModeUI.SetCropUI(ViewControl.IsCropMode());
- }
- }
- }
- public void SetVisibilityWhenContentEdit(Visibility visible)
- {
- ViewModeUI?.SetSplitContainerVisibility(visible);
- ViewModeUI?.SetCropContainerVisibility(visible);
- }
- }
- }
|