DialogPageDesigner.Net.cs 1.2 KB

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