0

My form looks gorgeous (YMMV) at design-time:

enter image description here

...but gets "stretchy" vertically when running on the device and, in fact, is a little too tall for the screen:

enter image description here

Why would this happen, and how can I prevent it from happening?

Possibly noteworthy: Form's WindowState == Normal, FormBorderStyle = FixedDialog

B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
  • 1
    I'm not seeing the "stretch". Is the Form on the device taller than what you have set in the designer properties? By how many pixels? – ctacke May 30 '14 at 21:45
  • Maybe my eyes deceive me; it seems to me that I perceive an elongation of the form; I wouldn't know how to tell the pixel difference; at any rate, I scrunched up the controls as much as I can, and it fits (barely) now. – B. Clay Shannon-B. Crow Raven May 30 '14 at 21:57
  • 1
    Set the exact height of the form in the designer to the height of the display resolution. You should be able to use Pain.NET or whatever to measure pixels from your screen grabs. – ctacke May 30 '14 at 23:03
  • That sounds like a pain. – B. Clay Shannon-B. Crow Raven May 30 '14 at 23:09
  • Out of curiosity, why does your designer look like a Windows XP desktop winform designer? In your project, What device type are you targeting, and what skin or formfactor did you select? – tcarvin Jun 02 '14 at 12:56
  • @tcarvin: It looks like XP because it is Visual Studio 2003 running in XP Mode, the only configuration in which this app will compile/build – B. Clay Shannon-B. Crow Raven Jun 02 '14 at 15:41

1 Answers1

1

please check your form settings: AutoScaleMode and Size settings.

Is this your first Windows CE application? You have to keep in mind that there are devices with different resolutions (ie QVGA, square like 320x320 pixels, etc), so you should adjust your layout to the screen size. Or make your form maximized and set AutoScroll to enbaled (if the content does not fit).

When you design your form, you are using pixel counts. These are transformed to twips (1/1440dpi) and again transformed (on the device) back to pixels (including a correction for the resolution, the dots-per-inch (dpi)). So a form with 240x240 pixels will have adifferent size on a 96dpi and a 102dpi display. This scaling is controlled by AutoScaleMode.

josef
  • 5,951
  • 1
  • 13
  • 24