Delphi 2010 Formats Displayed on the โ€œWrongโ€ Monitor

I have a simple test application with one blank form and a second containing TButton. The script button looks like this: -

procedure TForm1.Button1Click(Sender: TObject); begin Form2.Show(); end; 

Form2 automatically created at startup. There is no other code at all.

When I launch the application, I can click the button and Form2 will appear. I can resize / resize Form2 on the main monitor and then close it. If I press the Form1 button again, Form2 will reappear in the position in which it was last. Everything is fine so far ...

However, if I put Form2 on the secondary monitor, close it, and then click the button, then Form2 will appear on the main monitor!

I want the form to reappear on the monitor it was last in - how can I get this behavior?

+6
source share
1 answer

This is because the default value for the dmActiveForm property is dmActiveForm .

Set Form2 DefaultMonitor to dmDesktop and the problem will be solved.

+10
source

Source: https://habr.com/ru/post/944624/


All Articles