3

I have a problem. I create a fullscreen form in Delphi XE2. Then I run my application on tablet PC with windows 7 on board where screen resolution is 1024x600. Then I rotate tablet PC (now resolution is 600x1024) and I had some problems with elements on form (some buttons are behind the screen, etc.). Can I configure project so that when I turn the tablet PC my form is not rotate?

Jerry Dodge
  • 26,858
  • 31
  • 155
  • 327
0xFF
  • 585
  • 1
  • 6
  • 22
  • Are you using VCL or FMX? – Jerry Dodge Dec 03 '14 at 18:09
  • I use VCL. Is it in principle? – 0xFF Dec 04 '14 at 04:06
  • The approach to fixing your issue is very fundamental to the framework you're using. It's like buying car parts for a Chevy as opposed to parts for a Ford. – Jerry Dodge Dec 04 '14 at 04:07
  • Ok, I understand. If I use VCL can I fix my situation? – 0xFF Dec 04 '14 at 04:52
  • Why don't you fix the real problem? Nobody likes reading things sidewise. Why don't you make your program work with rotation instead of against it? – David Heffernan Dec 04 '14 at 08:25
  • Because owner of this program don't want see our program in portrait orientation. I said him that we'll need adapt program for this situation (I think this is necessary and logically), but he don't want listen this. That's why I want know if it's possible in theory? And how I can do this? – 0xFF Dec 04 '14 at 09:22
  • For Windows 8 there is [SetDisplayAutoRotationPreferences](http://msdn.microsoft.com/en-us/library/dn376361%28v=vs.85%29.aspx). – Sertac Akyuz Dec 04 '14 at 20:44
  • It' great, but I need support all systems from Windows XP SP3. But thanks. – 0xFF Dec 05 '14 at 05:39
  • You need to recalibrate your expectations – David Heffernan Dec 05 '14 at 07:00

1 Answers1

0

According to this MSDN article you can detect that the screen has been rotated by listening for the WM_DISPLAYCHANGE message.

However, you then face a serious problem. You now need to paint your entire app with a 90 degree rotation. That's going to take quite a bit of doing. I honestly don't believe it to be a tractable solution. I suspect that the viable options are to:

  • Modify your program so that it works in both orientations, or
  • Configure the device so that it is always in your preferred orientation.
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490