[C#] Screen rotation issue - Windows Mobile Software Development

Hi!
I'm fighting a bug for several hours now... I'm coding a game that needs to be in landscape mode. On the emulator, the HTC Touch Diamond and the HTC Touch HD2 my code works like a charm, but on the HTC Touch HD it doesn't.
In the constructor of the main form I do a
Code:
Microsoft.WindowsCE.Forms.SystemSettings.ScreenOrientation =
Microsoft.WindowsCE.Forms.ScreenOrientation.Angle90;
That does it on the two mentioned phones. But the situation on the other phone is as shown in the image in the attachment.
I already tried to:
PInvoke ChangeDisplaySettingsEx from coredll.dll and set the screen to portrait, then set it to 90° with the above code (Angle90). I tried only to set 90° over ChangeDisplaySettingsEx... and I tried not to rotate the display at all. But it always shows in one of the cases shown in the picture (see attachment).
It kind of seems like that the phone doesn't really change to landscape (only the form does). Like the phone doesn't rotate the display, but only shows the content rotated... how can I fix that?
Thanks!
sepsys

it's just guessing, but do have any rotation tool like gyrator installed on your HD? maybe that comes across...

Obelix_A said:
it's just guessing, but do have any rotation tool like gyrator installed on your HD? maybe that comes across...
Click to expand...
Click to collapse
I'll check it as soon as I, but I don't think so... Someone suggested it could have something to do with the HTC Skin on the mobile that prevents the Screen from rotating. Is that possible? And if yes how can I solve it? The game should also run under those circumstances.

Finally after 2 days:
I need to change the rotation in EVERY frame. Surprisingly it works just fine (even on slower phones).

For others with the same problem:
You should do it only once after first form paint. It works great.
Code:
bool once = true;
private void Form_Paint(object sender, PaintEventArgs e)
{
if (this.once)
{
Microsoft.WindowsCE.Forms.SystemSettings.ScreenOrientation =
Microsoft.WindowsCE.Forms.ScreenOrientation.Angle90;
this.once = false;
}
}

Related

Gyrator 2 Settings

Im not sure where the settings for gyrator controled events are stored, but if there is such a location could you help share your settings so we can all get a better grip of this great app?
I've tried adding some Events myself, but ive not been very successful.
Could someone help me get Gyrator to do some of the following:
* When TOMTOM is being used, I would like the screen to rotate landscape or portrait respective to the appropiate angle the HD is faced. However, I would like the rotation to stay fixed once the stylus is inserted. The rotation direction should only be able to change when the stylus is removed. (This should help me lock the screen to a landscape direction if needed or portrait if needed, and not have to worry about bumps in the road flipping my screen all over the place when driving.)
* When Windows Media Player is being used, I would like Gyrator not to rotate the screen whatsoever, because the WMP app seems to have G-Sen rotation already built in, and with Gyrator running, the phone gets very confused, and tries to show my video in lanscape on the portrait facing screen, thus chopping off half of the video)
* if anyone can suggest any other usefull Events that they've found useful, please let me know too (and if possible, let me know how to do it)?
Thanks.
BTW, ive looked at the Gyrator website, and their instructions are not the easiest to follow. (oh, and I find Gyrator 2 to be a much better app than the alternatives, hence why I am sticking with it - hoping I will learn how to use it much better)
Cheers.
WizzKidd
http://forum.xda-developers.com/showthread.php?p=3008510#post3008510
That should have answers to all your needs (including WM Player and TT)
if you still have questions after reading the thread, let me know
Thanks, that helped wonders!

Screen rotation How can i do this ?

how can i simulate keyboard sliding out (without actually opening it) to obtain the landscape state with all programs so that i can switch from portrait view (4all) to landscape (4all) apart from the G sensor.
I have tried all rotation programs ( Gyrator2, changescreen, G-config, G list) and i'm really disappointed they have issues with the phone dialer and with switching to certain programs they return to portrait view even if this program is enabled for rotation by above software.
If i can do what i mentioned above it will be great hack that will resolve many problems
where r the developers
Don´t need a developer for that, a simple search might have yielded the results you are looking for....
Get a registry editor, then change HKLM>System>GDI>Rotation>HideOreintaionUI from 1 to 0. Now you can assign the left hardware key long press action (under Settings>Buttons) to rotate your screen.
edit for not completely reading your post.....
Get a registry editor, then change HKLM>System>GDI>Rotation>HideOreintaionUI from 1 to 0. Now you can assign the left hardware key long press action (under Settings>Buttons) to rotate your screen.
even that doesn't prevent the phone from switching to portrait view specially with the phone dialler
As far as I know, Gyrator2 is currently the best option out there. It doesnt work perfectly in the TF3D interface tabs, but everywhere else, it works pretty well.
Hopefully a better solution will come out soon, cause I agree, this thing should work like an iphone in switching between portrait/landscape modes.
honestly, im using g config and g list and dont have any problems out of it...the only thing i dont like about it is that when im making a phone call itll switch to landscape mode when i put it to my ear bc i never hold the phone str8 up and down...how do i disable it from switching from portrait to landscape while n the dialer screens....other than that, no problems this way...please explain ur problem more in depth and hopefully i can help
hopefully someone can help me with my question tho about how to disable g config and g list from swtiching while the phone dialer screens are opened (during a call mainly)...thanks n adavance
by using registry editor delete "Dialog" string from
HKCU-->Software-->HTC-->HTCSENSOR-->GSensor-->WhiteList
the problem that the "dailog" string is responsible for rotation of other programs than the phone dialer for example u will discover that the favorite page of Opera browser will rotate no more after deleting this string.(and many other things that share this string)
there is another idea but i don't know how to do it through the registry?
By changing the horizontal rotation angle threshold to a minimal angle so you have to put your phone nearly horizontal to obtain landscape view.
meromar said:
there is another idea but i don't know how to do it through the registry?
By changing the horizontal rotation angle threshold to a minimal angle so you have to put your phone nearly horizontal to obtain landscape view.
Click to expand...
Click to collapse
this would be a great idea and if someone could figure that out and make a cab that would be great...a cab that makes it to where u have to have the phone "horizontal" (or nearly that so theres not as noticable of a lag) would be great because thats the only time i need the landscape is when im holding it horizontally...can someone PLEASE help????
Where are the EXPERTS
Gyrator2 can be configured to not switch while making a phone call. My problem is that I couldn't figure out how to get it not to switch in the lock screen. I'm sure that with enough help from the Gyrator experts I could have completely configured Gyrator to work the way I wanted it. Even if Gyrator had worked the way that I wanted it to, there were still issues with returning to portrait view even if I had the phone in landscape. But I believe that this is a known issue with Gyrator and touchflo 3D. But since I have the Tilt2, the easiest solution for me was mapping the PTT button to rotate my screen. At this point in time I don't think there is a perfect bug free solution and there might not be until HTC decides to implement that functionality.
thedon0369 said:
Gyrator2 can be configured to not switch while making a phone call. My problem is that I couldn't figure out how to get it not to switch in the lock screen. I'm sure that with enough help from the Gyrator experts I could have completely configured Gyrator to work the way I wanted it.
Click to expand...
Click to collapse
very easy : run Gyrator menu-->events-->add new event-->choose Orientation-->Edit Event-->(name it as u want)choose Application-->choose >Learn Widow Class-->click on task bar (Modify Event) to get out from Gyrator(but the program still running)-->lock ur screen-->withdraw ur stylus then reinsert it-->the Gyrator come back with ConfettiLockScreen in the application name (u can simply add it as new application for gyrator without doing previous steps.
Don't forget to make Orientation--> Portrait (only)
& Actions-->Rotate screen.
don't forget to promote it to become above rotate line.
meromar said:
how can i simulate keyboard sliding out (without actually opening it) to obtain the landscape state with all programs so that i can switch from portrait view (4all) to landscape (4all) apart from the G sensor.
I have tried all rotation programs ( Gyrator2, changescreen, G-config, G list) and i'm really disappointed they have issues with the phone dialer and with switching to certain programs they return to portrait view even if this program is enabled for rotation by above software.
If i can do what i mentioned above it will be great hack that will resolve many problems
Click to expand...
Click to collapse
WHERE ARE THE GENIUSES

LCD Panels - Some Answers

Ok I have seen a lot of confusion over the months regarding the LCD Panel fitted to the Kaiser, I will attempt to answer most of these issues here.
Hardware: The kaiser series is fitted with a 2.8 inch 240x320 TFT LCD panel, which means that it 240 pixels wide by 320 pixels deep, the optimum density of this LCD panel is 143 Pixels per Inch.
Resolution: This refers to the screen resolution that the Operating System will use to display on the LCD panel, the 3 most common being 240x320, 320x428 and 320x480, the reason this is possible is that the OS is capable of fooling the display into using the fixed 240x320 panel to display more pixels, ( it does not really have more pixels, it just looks like it).
DPI: DPI or Dots Per Inch, also known as Density, and correctly known as PPI or Pixels Per Inch, this refers to the number of pixels the screen displays in a One Inch Square on the screen. As I noted above, the actual PPI of the LCD panel is 143 PPI, this is fixed by the hardware, and cannot really be changed, however since the LCD is software driven, it can be persuaded to look as if it is displaying more or less pixels in that same area.
Panel Type: This refers to the actual LCD panel fitted to your device, there are 3 types fitted to the Kaiser series, one manufactured by Sony, the other two by Topoly. While the 3 different types of panel are functionally identical, they differ at the electronic level. On Windows Mobile this difference can be detected by the OS, however on Android this is not possible, so the panel type must be set in the parameters passed to the kernel at boot time, either in default.txt when booting from SD, or hardcoded in the NBH when booting from Nand. Also there is no easy way of telling which panel type is fitted to any given Kaiser, since the panel type was chosen by HTC depending on price and availability and stock at the time of manufacture, so any model of Kaiser can have any of these types fitted.
The main problems encountered with the display are usually solved by changing the Panel Type, either by editing default.txt, or reflashing the correct NBH, ( note that you can also edit the kernel parameters of an NBH using a Hex Editor, however this would be a relatively advanced method, since an error could cause major issues).
Changing screen resolution and density: As noted above there are 3 main resolutions used, 240x320, 320x428 and 320x480. These easy to change either by editing default.txt, or flashing an NBH, depending on how you run Android, resolution is usually a personal choice. Density is not as easy to change, although Rogue Tools by Myn, (available in Market, and discussed here: http://forum.xda-developers.com/showthread.php?t=667581), is excellent for this purpose, there are various common PPI settings, and again mostly personal choice, a little experimentation with resolution and density will allow you to find what you prefer.
Hope this helps clear things up a little
Thanks for this, it helps alot!
vertical lines issue
just to add to the above: the vertical lines issue some have is related to choosing the wrong panel type. Chosing the correct one will solve the problem.
Wrong panel make errors display, ok! But Can it lead to additional consumption of the battery?
Dark-Side said:
Wrong panel make errors display, ok! But Can it lead to additional consumption of the battery?
Click to expand...
Click to collapse
I suspect it may, since display errors such as vertical streaks, pixel errors, colour issues etc are actually caused by a mismatch between the OS drivers and the actual physical electronics, and it's possible that the panel may demand more power than it would normally, I'd have to bench test this to be sure, but it's probably easier just to use the correct panel type setting.
The correct panel type should lead to a 'normal' demand on the battery.
zenity said:
I suspect it may, since display errors such as vertical streaks, pixel errors, colour issues etc are actually caused by a mismatch between the OS drivers and the actual physical electronics, and it's possible that the panel may demand more power than it would normally, I'd have to bench test this to be sure, but it's probably easier just to use the correct panel type setting.
The correct panel type should lead to a 'normal' demand on the battery.
Click to expand...
Click to collapse
I use panel 2... I go to use panel 3 to test this. panel 1 make for me pixel errors. I'll report here.
Thank you
EDIT: no difference between panel 2 or 3 on my kais130
Thanks! That helps a lot.
I havd a thought, which is to change a physical LCD panel for my kaiser, HVGA or VGA... Is that possible? I would look into some electronic files later...
i guess that our chip has max resolution only 320x240 so no higher resolution
but as I look in the pdadb.net there are some devices with higher resolution and same chipset as ours so perhaps it is possible
It is unlikely to be possible to use another panel, since there are a lot of differences with the interface, it's not just the chipset, but how it's wired, plus higher resolution panels may need extra address lines which are not present in our kaisers.
For those of you experimenting with LCD Density settings. You may wish to try the following density settings.
100
121
144
169
196
Remember, pixels are square, so the density settings should reflect this, also the extreme ends of this table are just that, extreme
zenity said:
For those of you experimenting with LCD Density settings. You may wish to try the following density settings.
100
121
144
169
196
Remember, pixels are square, so the density settings should reflect this, also the extreme ends of this table are just that, extreme
Click to expand...
Click to collapse
density 106 works very well with 240x320 if the build is designed for 320x480. I'm using that on the CyanogenMod port. Haven't tried it with other builds though. I did try 107 once with another build but that did not turn out very well.
106? that should really look a little blurry, but I think it depends on the resolution that the build was designed for, however I think I'd find it a little small personally, have you tried 100? it should look clearer than 106, although I have noticed that some people just prefer a certain density regardless of the actual mathematically 'correct' one.
zenity said:
...
Panel Type:....
.... On Windows Mobile this difference can be detected by the OS, however on Android this is not possible, ...
Click to expand...
Click to collapse
So how do I detect which panel in winmo?
I don't like the idea of just stabbing blindly in the dark and hoping I get it right.
Basically? Stab in the dark, there is no way in wm or android to know which type is fitted, type 2 seems most common, and is usually a 'safe' default, if the graphics/colours are wrong, you probably have type 1, if you have issues waking from sleep then you probably have type 3. So try panel 2 first.
Sent from my HTC Dream using Tapatalk
I'm running Android on my HTC Tilt and am using panel 2. I tried panel 1 and the colors were off so Panel 2 seems good.
But the problem I am having is that when I open up the dialer, it doesn't fit correctly on the screen, the bar which shows which numbers you have entered covers up the numbers 1,2,3 and the sides are cropped.
Everything else seems to be fine why is the dialer messed up?
Should I try changing density its at default right now.
I personally like to use 110, but every time I open detail application on Market, it gave me force close. Facebook for Android does that too (I mean FC) whenever I open detail message or upload picture from gallery.. I've tried 106, 104 and 100 and still having the same problem.. it's not happening when I use 120 for density, everything seems work properly normal.. is that common or I have to do something to fix that problem?
Thats not normal behaviour for market, although it has been known to be a little flakey on some builds, however this is unlikely to be related to lcd density, since density only affects the visual appearance of the screen, not the OS itself.
Which Panel?2 or 3?
Am using HTC Tytn II and recently i tried almost all Android builds(donut,eclair,froyo) on my device.panel 1 shows some pixel errors and panel 2 and 3 makes no big difference for me, both settings showing a white flash screen on wake up!
and panel 3 i feel little smudge,not sure.panel 2 wake up with white flash screen and follows by grains(just like noisy TV screen).All these for two seconds.after that TYTN II behave normally.Any body can help me please?
stajan said:
Am using HTC Tytn II and recently i tried almost all Android builds(donut,eclair,froyo) on my device.panel 1 shows some pixel errors and panel 2 and 3 makes no big difference for me, both settings showing a white flash screen on wake up!
and panel 3 i feel little smudge,not sure.panel 2 wake up with white flash screen and follows by grains(just like noisy TV screen).All these for two seconds.after that TYTN II behave normally.Any body can help me please?
Click to expand...
Click to collapse
As previously stated, panel 2 is the most common of all.
As for the white flash and grainy display, this is due to the fact that we have to "fake v-sync" in order to display anything on our screens. Remember, Android was not designed for our Kaisers, but developers got it to run, piece by little piece, really well on our devices. There will always be drawbacks to this as the hardware doesn't really meet the requirements of what Android was developed for.
If you want to see whats going on when you have a white screen or snow, slide the keyboard open and press "Fn-left softkey". this brings up a screen that shows you what Android is doing.
To return to the main screen, press "Fn-right softkey".
Hope this helps...

[Q] 5 seconds to switch to Landscape ? **Resolved**

I've tweaked the Rhodium to auto rotate on just about everything, so it goes to landscape when I rotate the phone without having to slide out the keyboard.
problem is, it takes 5 elephants to rotate, and only 2 elephants to rotate back to portrait, I've set the G-Sensor polling rate to 50 but it made no difference at all to this. I would guess there is a control somewhere for this, either in the registry or hard coded in a file, anybody upto the task of finding out where the setting is ?
Slightly off topic, I've noticed that pictures don't rotate with the device anymore like they did in the Touch pro, this is a bit of an annoyance too because scrolling through pic's in landscape shows the images on their sides, not sure if this is a bug or by design ?
webwolf_3000 said:
I've tweaked the Rhodium to auto rotate on just about everything, so it goes to landscape when I rotate the phone without having to slide out the keyboard.
problem is, it takes 5 elephants to rotate, and only 2 elephants to rotate back to portrait, I've set the G-Sensor polling rate to 50 but it made no difference at all to this. I would guess there is a control somewhere for this, either in the registry or hard coded in a file, anybody upto the task of finding out where the setting is ?
Click to expand...
Click to collapse
What auto-rotator are you using?
I use changescreen, and my auto-rotation is fast.
I do these reg-edits with changescreen:
Code:
HKLM\Drivers\BuiltIn\GSensor\PollingInterval = 50 (Dword)
HKCU\Software\idevelopstuff\changescreen\Delay = 50 (Dword)
Depending on your auto-rotator, it might have a separate polling interval from the device's. As you can see, I have to set the GSensor's polling interval and changescreen's polling interval to the same amount for it to work quickly.
I didn't have a third party application for it, just the stock driver / app, Sounds like that will be the solution though, I did use Advance config to change the poll to 50, but looking in the registry it was set at 1000.
I've installed Changescreen and set both reg values to 50, it's rotating in roughly one elephant to landscape and back to portrait, much better
thanks for the tip.
ChangeScreen Keeps Rotating back to Portrait
Hey guys:
I have ChangeScreen installed on my HTC Tilt2. Ive set the default on load to landscape as well as set up exceptions to manilla and most of my programs to landscape (as an assurance that the screen will load each app/prog chosen to landscape).
I have set the registry keys listed in this string to 50 and saved the settings.
My problem is this: I have to hold my phone upright , then lay it flat, then pick it up again in order for the rotation to take effect.
Next prob is: after the screen does go into landscape, then i go to , say messaging, all is good until i exit messaging and navigate back to the today screen. It loads back "portrait". I have to do the same steip over : pick phone up; lay it flat; then pick up again for it to go back to landscape, otherwise, it just sits and sits and sits in portrait.
Is there any other tool better than changescreen that truely 'defaults' the screen rotation to landscape where i dont have to manually keep moving the phone all the time just to get to landscape?
RicoATT said:
Hey guys:
I have ChangeScreen installed on my HTC Tilt2. Ive set the default on load to landscape as well as set up exceptions to manilla and most of my programs to landscape (as an assurance that the screen will load each app/prog chosen to landscape).
I have set the registry keys listed in this string to 50 and saved the settings.
My problem is this: I have to hold my phone upright , then lay it flat, then pick it up again in order for the rotation to take effect.
Next prob is: after the screen does go into landscape, then i go to , say messaging, all is good until i exit messaging and navigate back to the today screen. It loads back "portrait". I have to do the same steip over : pick phone up; lay it flat; then pick up again for it to go back to landscape, otherwise, it just sits and sits and sits in portrait.
Is there any other tool better than changescreen that truely 'defaults' the screen rotation to landscape where i dont have to manually keep moving the phone all the time just to get to landscape?
Click to expand...
Click to collapse
Have you tried not having Manila in the exceptions list? Just let it auto-rotate based on your settings in the first tab in the changescreen app.
Or could you post screenshots of your settings so I can look at them and see if there's something conflicting, etc.?

only half of the touch screen working

Hi
I had a cracked screen before and I bought the component to fix it myself, (replacing the screen using service just cost too much in UK, I can almost buy another brand new phone) however the lower half of the screen does not work.
Is there any app that use to make my screen smaller so that I can actually use the usable section of the screen only please?
Search for Reachability and look at related apps. Those are designed to avoid the need to reach the top of your screen. Possibly they can work the opposite way too?
There's a shell command that can be used to "ignore" a part of the screen; "wm overscan". You can execute it with root privilege or from adb :
Code:
wm overscan [left],[top],[right],[bottom]
For example of you want to ignore 200 pixels from the bottom and 100 pixels from the top:
Code:
wm overscan 0,100,0,200
To cancel the effect :
Code:
wm overscan reset
By curiosity, having also faced trouble with touch screen after changing it, did you buy a screen already fixed in the frame or did you do it yourself ?

Categories

Resources