Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AutoScaling WinForm Display (Small, Medium)

First and foremost, please forgive me but my screenshots are in French due to my Windows installation at work. It is still very easy to understand though. I'll include screenshots to make it more visually appealing.

Here's some background information:

  • Windows 7 64bit
  • Visual Studio 2010
  • Default display is 100%
  • AutoScaleMode: DPI
  • AutoSize: True

Form properties

My application is a windows form that was developped in a default (small - 100%) display. Like so: Small (default) display

As you can see, the "Petite" or Small display is the default selection.

Small Display - 100% (default)

Here is how my application looks with this setting. This is the correct display Perfect display

Medium Display - 125%

The red rectangles point out the unwanted empty space. Display at Medium or 125 percent

I have tried:

  • Anchoring / Docking my controls such as my split containers, table layout panels, list views on Form_Load and via the UI. This didn't work.
  • Adding a split container to the form, and all controls respectively separated into it
  • Adding Table layout panels, where all textboxes and buttons are located in their respective cells

I really thought it was having a scaling problem because of the anchoring and docking. Although that didn't seem to be the problem ... What seems to be having trouble is the Tab Control and Listviews ...

Some users (most) have their settings as the default (100%) but there are a few who have it at a Medium setting, causing this scaling issue. Is there a way to fix this?

like image 973
Alex Avatar asked Oct 05 '22 07:10

Alex


2 Answers

I cant see your screenshots or links for some reason so I cannot visualize the problem. If scaling is the problem, try setting AutoScaleMode to None.

I recently had to do this because my winform app was image intensive and it would not render correctly on Medium Settings because I built it using the default Small Settnigs display. Changing scale mode to None worked for me.

like image 87
tsiorn Avatar answered Oct 13 '22 12:10

tsiorn


I fixed my issue by putting the tab controls and list views in a tablelayoutpanel. Everything that wasn't scaled properly had to be put inside a TableLayoutPanel. I kept my AutoScaleMode to DPI and AutoSize to True

Be sure to dock everything in their parent containers.

Here's the document outline for the more visual (like me):

Outline

like image 20
Alex Avatar answered Oct 13 '22 11:10

Alex