将 Windows CE 应用程序移植到 Windows Mobile

发布于 2024-08-19 10:36:21 字数 412 浏览 10 评论 0原文

我有一个相当复杂的应用程序,最初是为 Windows CE 构建的(使用 Visual Studio 2008,C# 2.0)。我现在正尝试让它在 Windows Mobile 设备上运行。然而,有一些用户界面怪癖。我注意到背景颜色全是白色,并且许多控件周围似乎没有像 WinCE 上那样有任何边框。但是,我最大的问题是我的应用程序似乎占据了全屏,因此我看不到带有开始菜单和单击的顶部任务栏(大概还有我的应用程序的关闭按钮?)。我也看不到通常具有显示/隐藏键盘图标的底部栏(任务栏?)。

我的表单在 CE 上设置为最大化,因此它应该占据大部分屏幕空间,而不是任务栏。我注意到,在创建新的智能设备项目时,Visual Studio 会提示输入目标平台(Windows CE 或 Windows Mobile)。我真的希望我不必重新编译我的应用程序即可在 Windows Mobile 上正常工作。

I have a rather complex application that was originally built for Windows CE (using Visual Studio 2008, C# 2.0). I'm now trying to get it to run on a Windows Mobile device. There are a few UI quirks, however. I notice that the background color is all white and there doesn't appear to be any borders around a lot of the controls like there is on WinCE. However, my biggest issue is that my application seems to take up the full screen so I can't see the top task bar with the start menu and the click (and presumably the close button for my app?). I also can't see the bottom bar (taskbar?) that normally has the icon to show/hide the keypad.

My form is set to maximized on CE so it should take most of the screen space but not the taskbar(s). I've noticed that Visual Studio prompts for the target platform (either Windows CE or Windows Mobile) when creating a new smart device project. I really hope that I don't have to recompile my application to work properly on Windows Mobile.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

焚却相思 2024-08-26 10:36:21

在 Windows Mobile 上,将表单的 WindowsState 属性设置为 FormWindowState.Maximized 将导致表单全屏显示,覆盖顶部的导航栏等。

我已经做了很多 Windows Mobile <--> Windows CE 移植,一般来说,如果我需要解决这样的差异,我最终会在执行平台检测检查后在运行时设置适用的属性。

使用 .NET CF 3.5,您可能会得到如下结果:

using Microsoft.WindowsCE.Forms;

if (SystemSettings.Platform == WinCEPlatform.WinCEGeneric)
  this.WindowState = FormWindowState.Maximized;
else
  this.WindowState = FormWindowState.Normal; // Pocket PC or Smartphone

幸运的是,出现此类差异的情况并不多。

对于 Visual Studio 提示您选择目标平台的问题,在大多数情况下(至少对于基于 .NET CF 的项目),这只是更改您可以选择的表单设计器工具箱中的模拟器和控件列表。

在大多数情况下,您应该能够针对一个平台构建应用程序并在另一个平台上运行生成的可执行文件。

此功能的一个方便用途是,如果您尝试使用特定平台不支持的功能,它会向您发出警告。例如,如果您尝试使用 System.Windows.Forms.Button 控件,选择智能手机平台将发出警告,因为智能手机(非触摸屏)设备不支持这些控件。

On Windows Mobile setting your form's WindowsState property to FormWindowState.Maximized will cause the form to become fullscreen covering the nav bar at the top etc.

I have done a lot of Windows Mobile <--> Windows CE porting and in general if I need to resolve differences like this I end up setting the applicable properties at runtime after I've performed a platform detection check.

Using .NET CF 3.5 you could end up with something like the following:

using Microsoft.WindowsCE.Forms;

if (SystemSettings.Platform == WinCEPlatform.WinCEGeneric)
  this.WindowState = FormWindowState.Maximized;
else
  this.WindowState = FormWindowState.Normal; // Pocket PC or Smartphone

Luckily there are not too many cases where such differences pop up.

With respect to Visual Studio prompting you to select the target platform, for the most part (atleast for.NET CF based projects) this simply changes the list of emulators and controls from the form designer toolbox that you are able to select.

In most cases you should be able to build your application against one platform and run the resultant executable on another.

One handy use of this feature is the fact that it will provide you with warnings if you attempt to use something not supported by a particular platform. For example selecting a smartphone platform will issue warnings if you attempt to use System.Windows.Forms.Button controls, since these are not supported on smartphone (non touch screen) devices.

年华零落成诗 2024-08-26 10:36:21

正如您现在所发现的,Windows Mobile 应用程序的屏幕空间比 Windows CE 少一些。您将有一个顶部和底部栏,有时还有一个用于托盘图标的附加底部栏。

要解决此问题,您应该进行平台检查,然后如果是 Windows Mobile,则缩小表单。
如果您在不更改表单的情况下无法做到这一点(就像在我的大多数情况下),您可以尝试使用软键并去掉任何按钮、复选框等。软键可以充当按钮,也可以是如果需要的话,可以是菜单,甚至是菜单中的菜单。

如果您已经在 Windows CE 中拥有一个可以运行的应用程序,则不必太担心目标平台。您不必切换到 Windows Mobile,尽管您可以访问模拟器和工具箱中支持的控件,正如已经指出的那样。

As you have found out by now, Windows Mobile apps have a little less screen estate than Windows CE. You will have a top and bottom bar and sometimes an additional bottom bar for tray icons.

To get around this problem you should do a platform check and then make your form smaller if it's windows mobile.
If you can't do that without making changes to the form (like in most of my cases) you can try to utilise the soft keys and get rid of any buttons, checkboxes etc. The soft keys can act as buttons or they can be menus and even menus inside menus if you want.

Don't worry much about the target platform if you already have a working app in Windows CE. You don't have to switch to Windows Mobile, although you will get access to the emulators and the supported controls in the toolbox as have been pointed out already.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文