0

I'm actually working on an app which will have to work on a Windows Tablet. I have a weird issue which is pissing me of. Only one of my forms does'nt want to respect de StartPosition.CenterScreen and start as shown on the image.

Displaying Issue

I've searched tips and tricks but the fact is that it works on my PC so I don't understand what the problem is.

Here are some things I've found that didn't work :

this.StartPosition = FormStartPosition.Manual;
this.Top = (Screen.PrimaryScreen.Bounds.Height - this.Height)/2;
this.Left = (Screen.PrimaryScreen.Bounds.Width - this.Width)/2;

Instead of

this.StartPosition = FormStartPosition.CenterScreen;

Then I've tried removing those two elements as I've shown during my searches

this.Text;
this.MaximumSize;

And I've put them on the loading event but it didn't work.

Finally I've tried this code in the calling form :

this.Hide();
FrmMain frm = new FrmMain(User, Centrale, Frequence);
frm.StartPosition = FormStartPosition.CenterScreen;
frm.ShowDialog();
this.Close();

But didn't work either. So I require your help, and I only want the form to be centered no matter the way.

================================= UPDATE ==================================

I've found a way to fix my issue. Indeed, thanks to @HansPassant and @Anil, I've tried to change my screen resolution on my own PC, so I could run it with my debugger. After a few attempts, I've changed the AutoScale property even if there was the following message : Obsolete : "This property has been deprecated. Use the AutoScaleMode property instead. http://go.microsoft.com/fwlink/?linkid=14202".

Well thanks for all

Shunter
  • 1
  • 2
  • https://stackoverflow.com/questions/13228185/how-to-configure-an-app-to-run-correctly-on-a-machine-with-a-high-dpi-setting-e – Hans Passant Feb 22 '19 at 08:50
  • @HansPassant well thanks but it is not my problem here, my issue is about centerscreen not blurry font :/ – Shunter Feb 22 '19 at 09:10
  • I think @HansPassant want to say that resolution on your PC and tablet is different may that is the reason it is not in center – Anil Feb 22 '19 at 09:51
  • Also take a look at this https://stackoverflow.com/questions/13456469/form-looks-different-on-another-computer and read about flow layout panel – Anil Feb 22 '19 at 10:00
  • Ok so I tried setting a lower resolution on my PC and you were right : now even on my PC it doesn't center my form. So do you have any idea about what I could change ? – Shunter Feb 25 '19 at 07:02

0 Answers0