watbywbarif
watbywbarif

Reputation: 7017

Bug in form display when upgrading .NET version and editing form

First of all, I upgraded my project form .NET 3.5 to 4.0 recently. I had no problems.

But now I have made some changes and consequence is that form is displayed bad on all computers that have not installed Visual studio 2010. They have .NET 4.0, otherwise I could not run that program.

I only have to add one button and designer changes two other things:

 <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>

goes to (in .resx file)

<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>

And pairs like:

    ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit();
    ...
    ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit();

appear in .Designer.cs InitializeComponent()

If i revert this changes in code form is displayed OK on all computers, if I leave them form is missing many child controls and it seams like most of them slipped out of screen, but only on computers which don't have VS2010. How to fix this and how is this connected with having VS2010 installed on computer?

Upvotes: 0

Views: 473

Answers (1)

AVIDeveloper
AVIDeveloper

Reputation: 3496

This sounds like a DPI issue where the DPI on your dev. PC (e.g. 120dpi) is different than the DPI on your other PCs (e.g. 96dpi).

If you don't intent to support different DPIs in your application, then just make sure that you develop your code on a PC which is set to the target DPI resolution (usually 96dpi).

If you would like to support various DPI resolutions, then Form.AutoScaleMode would be a good start. StackOverflow is also filled with resources about DPI problems and solutions.

Good luck.

Upvotes: 2

Related Questions