积极答复者
windows mobile 5.0 应用如何禁止手机响应转屏按键事件

问题
答案
-
here's a simple but ugly solution:
note that SystemSettings.ScreenOrientation needs to be changed, since its the parameter that decides the display orientation.the code:
void OrientationWatcher_Changed(object sender, ChangeEventArgs args) { int newOrientation = (int)args.NewValue; if (condition on newOrientation) ChangeToLandscape(); } public static void ChangeToLandscape() { SystemSettings.ScreenOrientation = ScreenOrientation.Angle270; Registry.SetValue(@"HKEY_LOCAL_MACHINE\System\GDI\ROTATION", "Angle", 270, RegistryValueKind.DWord); }
这个例子用来保持Landscape模式
I'm a device.- 已标记为答案 J.D HuangModerator 2009年5月10日 9:21
全部回复
-
楼主,你好
不好意思,刚才没理解清楚。
其实你说的转屏键其实对应的是键值为0X80.
你可以参考下面的这篇文章。
Keys and Key Codes for Windows Mobile
如果你想禁用这个键值,你可以添加按键检测事件。如果是这个键值,则不响应即可。
例子你可以参考下面的文章试试。
Control.KeyPress Event
Microsoft Online Community Support -
here's a simple but ugly solution:
note that SystemSettings.ScreenOrientation needs to be changed, since its the parameter that decides the display orientation.the code:
void OrientationWatcher_Changed(object sender, ChangeEventArgs args) { int newOrientation = (int)args.NewValue; if (condition on newOrientation) ChangeToLandscape(); } public static void ChangeToLandscape() { SystemSettings.ScreenOrientation = ScreenOrientation.Angle270; Registry.SetValue(@"HKEY_LOCAL_MACHINE\System\GDI\ROTATION", "Angle", 270, RegistryValueKind.DWord); }
这个例子用来保持Landscape模式
I'm a device.- 已标记为答案 J.D HuangModerator 2009年5月10日 9:21