DialogPageDesigner.WPF.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using FastReport.Forms;
  2. using System.Windows.Forms;
  3. namespace FastReport.Design.PageDesigners.Dialog
  4. {
  5. partial class DialogPageDesigner
  6. {
  7. private void UpdatePageFormLocation()
  8. {
  9. if (DialogPage == null)
  10. return;
  11. // avoid "bad form owner" bug
  12. System.Windows.Window designerForm = System.Windows.Window.GetWindow(Designer.control);
  13. if (designerForm == null || !designerForm.IsVisible)
  14. return;
  15. BaseForm form = DialogPage.Form;
  16. form.StartPosition = FormStartPosition.Manual;
  17. // locate the form on the bottom of the designer's screen. This will autoscale the form
  18. // according to the designer's dpi; also the form will not be visible on undo operations.
  19. Screen sc = Screen.FromControl(designerForm);
  20. form.MoveWindow(sc.WorkingArea.Left, sc.WorkingArea.Bottom, designerForm);
  21. form.Show();
  22. form.SendToBack();
  23. DialogPage.ResetFormBitmap();
  24. Focus();
  25. }
  26. private void HidePageForm()
  27. {
  28. if (DialogPage == null)
  29. return;
  30. DialogPage.Form.Hide();
  31. }
  32. }
  33. }